Examples of lengthSquared()


Examples of javax.vecmath.Vector3f.lengthSquared()

    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

Examples of javax.vecmath.Vector3f.lengthSquared()

    eyePos.set(0f, 0f, 0f);
    VectorUtil.setCoord(eyePos, forwardAxis, -cameraDistance);

    Vector3f forward = new Vector3f();
    forward.set(eyePos.x, eyePos.y, eyePos.z);
    if (forward.lengthSquared() < BulletGlobals.FLT_EPSILON) {
      forward.set(1f, 0f, 0f);
    }
    Vector3f right = new Vector3f();
    right.cross(cameraUp, forward);
    Quat4f roll = new Quat4f();
View Full Code Here

Examples of javax.vecmath.Vector3f.lengthSquared()

    end.setIdentity ();

    float fraction = 1.0f;
    Vector3f distance2Vec = Stack.alloc(Vector3f.class);
    distance2Vec.sub(currentPosition, targetPosition);
    float distance2 = distance2Vec.lengthSquared();
    //printf("distance2=%f\n",distance2);

    if (touchingContact) {
      if (normalizedDirection.dot(touchingNormal) > 0.0f) {
        updateTargetPositionBasedOnCollision(touchingNormal);
View Full Code Here

Examples of javax.vecmath.Vector3f.lengthSquared()

        updateTargetPositionBasedOnCollision(callback.hitNormalWorld);

        Vector3f currentDir = Stack.alloc(Vector3f.class);
        currentDir.sub(targetPosition, currentPosition);
        distance2 = currentDir.lengthSquared();
        if (distance2 > BulletGlobals.SIMD_EPSILON) {
          currentDir.normalize();
          // see Quake2: "If velocity is against original velocity, stop ead to avoid tiny oscilations in sloping corners."
          if (currentDir.dot(normalizedDirection) <= 0.0f) {
            break;
View Full Code Here

Examples of javax.vecmath.Vector3f.lengthSquared()

      Vector3f relPos = Stack.alloc(Vector3f.class);
      relPos.sub(pivotBInW, pivotAInW);

      // TODO: stack
      Vector3f[] normal/*[3]*/ = new Vector3f[]{Stack.alloc(Vector3f.class), Stack.alloc(Vector3f.class), Stack.alloc(Vector3f.class)};
      if (relPos.lengthSquared() > BulletGlobals.FLT_EPSILON) {
        normal[0].normalize(relPos);
      }
      else {
        normal[0].set(1f, 0f, 0f);
      }
View Full Code Here

Examples of javax.vecmath.Vector3f.lengthSquared()

          if (body.isActive() && (!body.isStaticOrKinematicObject())) {
            body.predictIntegratedTransform(timeStep, predictedTrans);

            tmp.sub(predictedTrans.origin, body.getWorldTransform(tmpTrans).origin);
            float squareMotion = tmp.lengthSquared();

            if (body.getCcdSquareMotionThreshold() != 0f && body.getCcdSquareMotionThreshold() < squareMotion) {
              BulletStats.pushProfile("CCD motion clamping");
              try {
                if (body.getCollisionShape().isConvex()) {
View Full Code Here

Examples of javax.vecmath.Vector3f.lengthSquared()

      Vector3f relPos = Stack.alloc(Vector3f.class);
      relPos.sub(pivotBInW, pivotAInW);

      Vector3f[] normal/*[3]*/ = new Vector3f[]{Stack.alloc(Vector3f.class), Stack.alloc(Vector3f.class), Stack.alloc(Vector3f.class)};
      if (relPos.lengthSquared() > BulletGlobals.FLT_EPSILON) {
        normal[0].set(relPos);
        normal[0].normalize();
      }
      else {
        normal[0].set(1f, 0f, 0f);
View Full Code Here

Examples of javax.vecmath.Vector3f.lengthSquared()

  @Override
  public Vector3f localGetSupportingVertex(Vector3f vec, Vector3f out) {
    Vector3f supVertex = coneLocalSupport(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

Examples of javax.vecmath.Vector3f.lengthSquared()

  @Override
  public void setLocalScaling(Vector3f scaling) {
    Vector3f tmp = Stack.alloc(Vector3f.class);
    tmp.sub(getLocalScaling(Stack.alloc(Vector3f.class)), scaling);

    if (tmp.lengthSquared() > BulletGlobals.SIMD_EPSILON) {
      super.setLocalScaling(scaling);
      /*
      if (ownsBvh)
      {
      m_bvh->~btOptimizedBvh();
View Full Code Here

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