Examples of lengthSquared()


Examples of net.phys2d.math.ROVector2f.lengthSquared()

      }
    }

    if (turning) {
      ROVector2f velocity = physics.getBody().getVelocity();
      float lengthSquared = velocity.lengthSquared()/20000f;
      tf.setFactor(tf.getFactor() * (lengthSquared/MAX_VELOCITY));
     
      updateRotating(player);

      //transform.addRotation(delta * (turnFactor * (v.getVelocity() / MAX_VELOCITY)));
View Full Code Here

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

    }
   
    Vector2f normal = endB; // reuse of vector object
    normal.set(startB);
    normal.sub(position);
    float distSquared = normal.lengthSquared();
    float radiusSquared = circle.getRadius() * circle.getRadius();
   
    if ( distSquared < radiusSquared ) {
      contacts[0].setPosition(position);
      contacts[0].setFeature(new FeaturePair());
View Full Code Here

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

        startA.x + uA * (endA.x - startA.x),
        startA.y + uA * (endA.y - startA.y));
   
    Vector2f dist = new Vector2f(position);
    dist.sub(startA);
    float distFromVertA = dist.lengthSquared();
    dist = new Vector2f(position);
    dist.sub(startB);
    float distFromVertB = dist.lengthSquared();
   
    // z axis of 3d cross product
View Full Code Here

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

    Vector2f dist = new Vector2f(position);
    dist.sub(startA);
    float distFromVertA = dist.lengthSquared();
    dist = new Vector2f(position);
    dist.sub(startB);
    float distFromVertB = dist.lengthSquared();
   
    // z axis of 3d cross product
    float sA = (startA.x - startB.x) * (endB.y - startB.y) - (endB.x - startB.x) * (startA.y - startB.y);
   
    if ( sA > 0 ) {
View Full Code Here

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

    dv.sub(body1.getVelocity());
    dv.sub(MathUtil.cross(body1.getAngularVelocity(),r1));
      dv.scale(-1);
      dv.add(bias); // TODO: is this baumgarte stabilization?
     
      if (dv.lengthSquared() == 0) {
        return;
      }
     
    Vector2f impulse = MathUtil.mul(M, dv);
View Full Code Here

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

    dv.sub(body1.getVelocity());
    dv.sub(MathUtil.cross(body1.getAngularVelocity(),r1));
      dv.scale(-1);
      dv.add(bias);
     
      if (dv.lengthSquared() == 0) {
        return;
      }
     
    Vector2f impulse = MathUtil.mul(M, dv);
View Full Code Here

Examples of nexus.model.structs.Vector3.lengthSquared()

  @Test
  public void testLengthSquared() {
    Vector3 a = new Vector3(1f, 2f, 2f);
   
    assertEquals(9f, a.lengthSquared(), 0);
  }

  @Test
  public void testScale() {
    Vector3 a = new Vector3(1f, 2f, -2f);
View Full Code Here

Examples of org.bukkit.util.Vector.lengthSquared()

    entity.setPosition(entity.loc.getX(), entity.loc.getY(), entity.loc.getZ());

    if (getGroup().getProperties().isManualMovementAllowed() && entity.hasPassenger()) {
      Vector vel = entity.getPassenger().getVelocity();
      vel.setY(0.0);
      if (vel.lengthSquared() > 1.0E-4 && entity.vel.xz.lengthSquared() < 0.01) {
        entity.vel.xz.add(vel.multiply(0.1));
      }
    }

    // Perform any pre-movement rail updates
View Full Code Here

Examples of org.bukkit.util.Vector.lengthSquared()

    if (!isCart && !isTrain) {
      return;
    }
    // Parse offset
    Vector offset = Util.parseVector(info.getLine(2), new Vector(0.0, 0.0, 0.0));
    if (offset.lengthSquared() == 0.0) {
      return;
    }
    // Rotate the offset so it becomes aligned with the sign
    float yaw = FaceUtil.faceToYaw(info.getFacing().getOppositeFace());
    offset = MathUtil.rotate(yaw, 0.0f, offset);
View Full Code Here

Examples of org.jbox2d.common.Vec2.lengthSquared()

            pAToShape.normalize();
            pAToShape.mulLocal(FORCE_MAGNITUDE);
            dc.getBody().applyForce(pAToShape,shapePos);
          }
        }else if(Vec2.dot(pBToShape, vecBToA)<0){
          if(pBToShape.lengthSquared()>ASBOTXConfigs.E_SQUARE){
            pBToShape.negateLocal();
            pBToShape.normalize();
            pBToShape.mulLocal(FORCE_MAGNITUDE);
            dc.getBody().applyForce(pBToShape,shapePos);
          }
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.