Examples of normalise()


Examples of com.flansmod.common.vector.Vector3f.normalise()

     
      Vector3f intent = new Vector3f(moveX, 0, moveZ);
     
      if(Math.abs(intent.lengthSquared()) > 0.1)
      {
        intent.normalise();
       
        ++legSwing;
     
        intent = axes.findLocalVectorGlobally(intent);
             
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 eas.simulation.spatial.sim2D.physicalSimulation.physicsEngine.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

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

       
        line.getClosestPoint(bodyB.getPosition(), pt);
        Vector2f normal = new Vector2f(bodyB.getPosition());
        normal.sub(pt);
        float sep = circle.getRadius() - normal.length();
        normal.normalise();
       
        contacts[noContacts].setSeparation(-sep);
        contacts[noContacts].setPosition(pt);
        contacts[noContacts].setNormal(normal);
        contacts[noContacts].setFeature(new FeaturePair());
View Full Code Here

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

   * @return The list of edges that can collide with the circle
   */
  protected int[][] getCollisionCandidates(Vector2f[] vertsA, ROVector2f centroid, float radius, ROVector2f circlePos) {
    Vector2f sweepDir = new Vector2f(centroid);
    sweepDir.sub(circlePos);
    sweepDir.normalise(); //TODO: this normalization might not be necessary
   
    EdgeSweep sweep = new EdgeSweep(sweepDir);//vertsA[0], true, true, dist);
   
    sweep.addVerticesToSweep(true, vertsA);
   
View Full Code Here

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

    for (int i=0;i<count;i++) {
      Vector2f vec = MathUtil.scale(contacts[i].getNormal(),-1);
      contacts[i].setNormal(vec);
     
      Vector2f pt = MathUtil.sub(contacts[i].getPosition(), circleBody.getPosition());
      pt.normalise();
      pt.scale(((Circle) circleBody.getBodyShape()).getRadius());
      pt.add(circleBody.getPosition());
      contacts[i].setPosition(pt);
    }
   
View Full Code Here

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

   
    Line line = (Line) bodyA.getBodyShape();
    Box box = (Box) bodyB.getBodyShape();
   
    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);
View Full Code Here

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

    Box box = (Box) bodyB.getBodyShape();
   
    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()

   
    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
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.