Examples of normalise()


Examples of eas.simulation.spatial.sim2D.physicalSimulation.physicsEngine.net.phys2d.math.Vector2f.normalise()

    Box box = (Box) bodyB.getShape();
   
    Vector2f lineVec = new Vector2f(line.getDX(), line.getDY());
    lineVec.normalise()
    Vector2f axis = new Vector2f(-line.getDY(), line.getDX());
    axis.normalise();
   
    Vector2f res = new Vector2f();
    line.getStart().projectOntoUnit(axis, res);
    float linePos = getProp(res,axis);
   
View Full Code Here

Examples of eas.simulation.spatial.sim2D.physicalSimulation.physicsEngine.net.phys2d.math.Vector2f.normalise()

      // between the two elements cross?
      Vector2f contactPoint = new Vector2f();
      lines[closest].getClosestPoint(circleBody.getPosition(), contactPoint);
     
      Vector2f normal = MathUtil.sub(circleBody.getPosition(), contactPoint);
      normal.normalise();
      contacts[0].setNormal(normal);
      contacts[0].setPosition(contactPoint);
      contacts[0].setFeature(new FeaturePair());
     
      return 1;
View Full Code Here

Examples of eas.simulation.spatial.sim2D.physicalSimulation.physicsEngine.net.phys2d.math.Vector2f.normalise()

    // dp.scale(1.0f/length);
    Vector2f V = new Vector2f((float) Math.cos(originalAngle
        + body1.getRotation()), (float) Math.sin(originalAngle
        + body1.getRotation()));
    Vector2f ndp = new Vector2f(dp);
    ndp.normalise();
    float torq = (float) Math.asin(MathUtil.cross(ndp, V))
        * compressConstant / invDT;
    float P = torq / length;
    Vector2f n = new Vector2f(ndp.y, -ndp.x);
    Vector2f impulse = new Vector2f(n);
View Full Code Here

Examples of mikera.vectorz.AVector.normalise()

  private void testNormalTransform(AAffineTransform t) {
    if (!t.isSquare()) return;
    int dimensions=t.inputDimensions();
    AVector d=Vectorz.newVector(dimensions);
    Vectorz.fillGaussian(d);
    d.normalise();
   
    AVector r=Vectorz.newVector(dimensions);
   
    t.transformNormal(d, r);
    assertTrue(r.isZero()||r.isUnitLengthVector());
View Full Code Here

Examples of mikera.vectorz.Vector3.normalise()

  public static void main(String[] args) {
    Vector3 v=Vector3.of(1.0,2.0,3.0);   
    System.out.println(v);
   
    v.normalise();   
    System.out.println(v);
   
    Vector3 d=Vector3.of(10.0,0.0,0.0);   
    d.addMultiple(v, 5.0);
    System.out.println(d)
View Full Code Here

Examples of net.phys2d.math.Vector2f.normalise()

      p2.add(new Vector2f(chains * 20, 0));
    }

    final Vector2f direction = new Vector2f(p2);
    direction.sub(p1);
    direction.normalise();
    direction.scale(20);

    final Body bodies[] = new Body[N];
    final Vector2f pos = new Vector2f(p1);
    for (int i = 0; i < N; i++) {
View Full Code Here

Examples of net.phys2d.math.Vector2f.normalise()

      Vector2f p2 = MathUtil.mul(R2,joint.getAnchor2());
      p2.add(x2);
     
      Vector2f im = new Vector2f(p2);
      im.sub(p1);
      im.normalise();
     
     
     
      g.setColor(Color.red);
      g.drawLine((int)p1.x,(int)p1.y,(int)(p1.x+im.x*joint.getMinDistance()),(int)(p1.y+im.y*joint.getMinDistance()));
 
View Full Code Here

Examples of net.phys2d.math.Vector2f.normalise()

   
    if ( distSquared < radiusSquared ) {
      contacts[0].setPosition(position);
      contacts[0].setFeature(new FeaturePair());
     
      normal.normalise();
      contacts[0].setNormal(normal);
     
      float separation = (float) Math.sqrt(distSquared) - circle.getRadius();
      contacts[0].setSeparation(separation);
     
View Full Code Here

Examples of net.phys2d.math.Vector2f.normalise()

    Vector2f startB = vertsB[intersection.edgeB];
    Vector2f endB = vertsB[(intersection.edgeB + 1) % vertsB.length];
   
    Vector2f normal = MathUtil.getNormal(startA, endA);
    normal.sub(MathUtil.getNormal(startB, endB));
    normal.normalise();
   
    contact.setNormal(normal);
    contact.setSeparation(0);
    contact.setFeature(new FeaturePair(intersection.edgeA, intersection.edgeB, 0, 0));
    contact.setPosition(intersection.position);
View Full Code Here

Examples of net.phys2d.math.Vector2f.normalise()

    }
   
    Vector2f normal = MathUtil.sub(bodyB.getPosition(),bodyA.getPosition());
    float sep = (circleA.getRadius() + circleB.getRadius()) - normal.length();

    normal.normalise();
    Vector2f pt = MathUtil.scale(normal, circleA.getRadius());
    pt.add(bodyA.getPosition());

    contacts[0].setSeparation(-sep);
    contacts[0].setPosition(pt);
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.