Package javax.vecmath

Examples of javax.vecmath.Vector3f.lengthSquared()


    // update the scaling without rebuilding the bvh
    Vector3f tmp = Stack.alloc(Vector3f.class);
    tmp.sub(getLocalScaling(Stack.alloc(Vector3f.class)), scaling);

    if (tmp.lengthSquared() > BulletGlobals.SIMD_EPSILON) {
      super.setLocalScaling(scaling);
    }
  }

  public boolean usesQuantizedAabbCompression() {
View Full Code Here


    Vector3f supVertex = out;
    localGetSupportingVertexWithoutMargin(vec, supVertex);

    if (getMargin() != 0f) {
      Vector3f vecnorm = Stack.alloc(vec);
      if (vecnorm.lengthSquared() < (BulletGlobals.SIMD_EPSILON * BulletGlobals.SIMD_EPSILON)) {
        vecnorm.set(-1f, -1f, -1f);
      }
      vecnorm.normalize();
      supVertex.scaleAdd(getMargin(), vecnorm, supVertex);
    }
View Full Code Here

    // Linear motion for one of objects needs to exceed m_ccdSquareMotionThreshold
    // col0->m_worldTransform,
    float resultFraction = 1f;

    tmp.sub(col0.getInterpolationWorldTransform(tmpTrans1).origin, col0.getWorldTransform(tmpTrans2).origin);
    float squareMot0 = tmp.lengthSquared();

    tmp.sub(col1.getInterpolationWorldTransform(tmpTrans1).origin, col1.getWorldTransform(tmpTrans2).origin);
    float squareMot1 = tmp.lengthSquared();

    if (squareMot0 < col0.getCcdSquareMotionThreshold() &&
View Full Code Here

    tmp.sub(col0.getInterpolationWorldTransform(tmpTrans1).origin, col0.getWorldTransform(tmpTrans2).origin);
    float squareMot0 = tmp.lengthSquared();

    tmp.sub(col1.getInterpolationWorldTransform(tmpTrans1).origin, col1.getWorldTransform(tmpTrans2).origin);
    float squareMot1 = tmp.lengthSquared();

    if (squareMot0 < col0.getCcdSquareMotionThreshold() &&
        squareMot1 < col1.getCcdSquareMotionThreshold()) {
      return resultFraction;
    }
View Full Code Here

  public Vector3f localGetSupportingVertex(Vector3f vec, Vector3f out) {
    Vector3f supVertex = localGetSupportingVertexWithoutMargin(vec, out);

    if (getMargin() != 0f) {
      Vector3f vecnorm = Stack.alloc(vec);
      if (vecnorm.lengthSquared() < (BulletGlobals.FLT_EPSILON * BulletGlobals.FLT_EPSILON)) {
        vecnorm.set(-1f, -1f, -1f);
      }
      vecnorm.normalize();
      supVertex.scaleAdd(getMargin(), vecnorm, supVertex);
    }
View Full Code Here

    supVec.set(0f, 0f, 0f);

    float maxDot = -1e30f;

    Vector3f vec = Stack.alloc(vec0);
    float lenSqr = vec.lengthSquared();
    if (lenSqr < 0.0001f) {
      vec.set(1f, 0f, 0f);
    }
    else {
      float rlen = 1f / (float) Math.sqrt(lenSqr);
View Full Code Here

    // quick approximation using raycast, todo: hook up to the continuous collision detection (one of the btConvexCast)

    // only perform CCD above a certain threshold, this prevents blocking on the long run
    // because object in a blocked ccd state (hitfraction<1) get their linear velocity halved each frame...
    tmp.sub(convexbody.getInterpolationWorldTransform(Stack.alloc(Transform.class)).origin, convexbody.getWorldTransform(Stack.alloc(Transform.class)).origin);
    float squareMot0 = tmp.lengthSquared();
    if (squareMot0 < convexbody.getCcdSquareMotionThreshold()) {
      return 1f;
    }

    Transform tmpTrans = Stack.alloc(Transform.class);
View Full Code Here

    Vector3f supVec = out;
    supVec.set(0f, 0f, 0f);
    float newDot, maxDot = -1e30f;

    Vector3f vec = Stack.alloc(vec0);
    float lenSqr = vec.lengthSquared();
    if (lenSqr < 0.0001f) {
      vec.set(1f, 0f, 0f);
    }
    else {
      float rlen = 1f / (float) Math.sqrt(lenSqr);
View Full Code Here

  public Vector3f localGetSupportingVertex(Vector3f vec, Vector3f out) {
    Vector3f supVertex = localGetSupportingVertexWithoutMargin(vec, out);

    if (getMargin() != 0f) {
      Vector3f vecnorm = Stack.alloc(vec);
      if (vecnorm.lengthSquared() < (BulletGlobals.FLT_EPSILON * BulletGlobals.FLT_EPSILON)) {
        vecnorm.set(-1f, -1f, -1f);
      }
      vecnorm.normalize();
      supVertex.scaleAdd(getMargin(), vecnorm, supVertex);
    }
View Full Code Here

      // add inertia tensor
      tensor.add(j);

      // compute inertia tensor of pointmass at o
      float o2 = o.lengthSquared();
      j.setRow(0, o2, 0, 0);
      j.setRow(1, 0, o2, 0);
      j.setRow(2, 0, 0, o2);
      j.m00 += o.x * -o.x;
      j.m01 += o.y * -o.x;
 
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.