Package javax.vecmath

Examples of javax.vecmath.Vector2d.scale()


            double slingAngleWithHorz = sling_.getAngleWithHorz();

            forceFromHook_.set(-cos(slingAngleWithHorz), sin(slingAngleWithHorz))//sin(PI - angle), -cos(PI + angle));
            forceFromHook_.scale( tangentialForceAtHook * sin(slingAngle));
            Vector2d gravityForce = new Vector2d(GRAVITY_VEC);
            gravityForce.scale(projectile_.getMass());
            forceFromHook_.add(gravityForce);
            // also add a restoring force which is proportional to the distnace from the attachpoint on the sling
            // if we have not yet been released.

            Vector2d restoreForce = sling_.getProjectileAttachPoint();
View Full Code Here


            // also add a restoring force which is proportional to the distnace from the attachpoint on the sling
            // if we have not yet been released.

            Vector2d restoreForce = sling_.getProjectileAttachPoint();
            restoreForce.sub(projectile_.getPosition());
            restoreForce.scale(100.0);
            forceFromHook_.add(restoreForce);
            projectile_.setForce(forceFromHook_, timeStep);
        else {
            Vector2d gravityForce = new Vector2d(GRAVITY_VEC);
            gravityForce.scale(projectile_.getMass());
View Full Code Here

            restoreForce.scale(100.0);
            forceFromHook_.add(restoreForce);
            projectile_.setForce(forceFromHook_, timeStep);
        else {
            Vector2d gravityForce = new Vector2d(GRAVITY_VEC);
            gravityForce.scale(projectile_.getMass());
            projectile_.setForce(gravityForce, timeStep);
        }


        // at the time when it is released, the only force acting on it will be gravity.
View Full Code Here

        Vector2d vec = new Vector2d();
        vec.sub( p2, p1 );

        Vector2d per = GeometryTools.calculatePerpendicularUnitVector( p1, p2 );
        per.scale( radius );
        Vector2d per2 = new Vector2d();
        per2.scale( -1 ,per);

        Vector2d v1= new Vector2d(vec);
        Vector2d v2= new Vector2d();
View Full Code Here

        vec.sub( p2, p1 );

        Vector2d per = GeometryTools.calculatePerpendicularUnitVector( p1, p2 );
        per.scale( radius );
        Vector2d per2 = new Vector2d();
        per2.scale( -1 ,per);

        Vector2d v1= new Vector2d(vec);
        Vector2d v2= new Vector2d();

        v1.normalize();
View Full Code Here

        Vector2d v1= new Vector2d(vec);
        Vector2d v2= new Vector2d();

        v1.normalize();
        v1.scale( radius );
        v2.scale( -1, v1 );

        Point2d f1 = new Point2d();
        Point2d f2 = new Point2d();
        Point2d f3 = new Point2d();
        Point2d s1 = new Point2d();
View Full Code Here

    public void visit(WedgeLineElement wedge) {
        // make the vector normal to the wedge axis
        Vector2d normal =
            new Vector2d(wedge.firstPointY - wedge.secondPointY, wedge.secondPointX - wedge.firstPointX);
        normal.normalize();
        normal.scale(rendererModel.getWedgeWidth() / rendererModel.getScale())
       
        // make the triangle corners
        Point2d vertexA = new Point2d(wedge.firstPointX, wedge.firstPointY);
        Point2d vertexB = new Point2d(wedge.secondPointX, wedge.secondPointY);
        Point2d vertexC = new Point2d(vertexB);
View Full Code Here

    double w2[] = invTransformPoint (p2[0], p2[1]);
        // make the vector normal to the wedge axis
        Vector2d normal =
            new Vector2d(w1[1] - w2[1], w2[0] - w1[0]);
        normal.normalize();
        normal.scale(rendererModel.getWedgeWidth() / rendererModel.getScale())
       
        // make the triangle corners
        Point2d vertexA = new Point2d(w1[0], w1[1]);
        Point2d vertexB = new Point2d(w2[0], w2[1]);
        Point2d vertexC = new Point2d(vertexB);
View Full Code Here

    if (connectedAtoms.size() == 0) {
      Point2d newAtomPoint = new Point2d(atom.getPoint2d());
      double angle = Math.toRadians(-30);
      Vector2d vec1 = new Vector2d(Math.cos(angle), Math.sin(angle));
      vec1.scale(bondLength);
      newAtomPoint.add(vec1);
      newAtom.setPoint2d(newAtomPoint);
    } else if (connectedAtoms.size() == 1) {
      IAtomContainer ac = atomCon.getBuilder().newInstance(IAtomContainer.class);
      ac.addAtom(atom);
View Full Code Here

      if (localObject != null)
      {
        this.c.a((com.a.a.d)localObject);
        paramd.a(Integer.valueOf(this.j));
        Vector2d localVector2d = new Vector2d(((com.a.a.a.a.b.c.c.a)localObject).d().f());
        localVector2d.scale(-((com.a.a.a.a.b.c.c.a)localObject).d().n() / paramd.d().n());
        paramd.d().f().add(localVector2d);
        this.c.a(new com.a.a.a.a.b.e.a(com.a.a.a.a.b.b.a.d((com.a.a.a.a.b.c.c.a)localObject), ((com.a.a.a.a.b.c.c.a)localObject).d().c(), ((com.a.a.a.a.b.c.c.a)localObject).d().d())).a(((com.a.a.a.a.b.c.c.a)localObject).d().e());
      }
    }
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.