Package javax.vecmath

Examples of javax.vecmath.Vector3f.normalize()


    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);
    }
    return supVertex;
  }

View Full Code Here


  public static void collideRAY(Node root, Vector3f origin, Vector3f direction, ICollide policy) {
    //DBVT_CHECKTYPE
    if (root != null) {
      Vector3f normal = Stack.alloc(Vector3f.class);
      normal.normalize(direction);
      Vector3f invdir = Stack.alloc(Vector3f.class);
      invdir.set(1f / normal.x, 1f / normal.y, 1f / normal.z);
      int[] signs = new int[] { direction.x<0 ? 1:0, direction.y<0 ? 1:0, direction.z<0 ? 1:0 };
      ObjectArrayList<Node> stack = new ObjectArrayList<Node>(SIMPLE_STACKSIZE);
      stack.add(root);
View Full Code Here

    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);
    }
    return out;
  }

View Full Code Here

    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);
    }
    return out;
  }
 
View Full Code Here

    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);
    }
    return out;
  }

View Full Code Here

    //#define RAYAABB2
    //#ifdef RAYAABB2
    Vector3f rayFrom = Stack.alloc(raySource);
    Vector3f rayDirection = Stack.alloc(Vector3f.class);
    tmp.sub(rayTarget, raySource);
    rayDirection.normalize(tmp);
    lambda_max = rayDirection.dot(tmp);
    rayDirection.x = 1f / rayDirection.x;
    rayDirection.y = 1f / rayDirection.y;
    rayDirection.z = 1f / rayDirection.z;
//    boolean sign_x = rayDirection.x < 0f;
View Full Code Here

        assertEquals(PercentHelper.getDecimalValue(25), mockSun.getRiseAngle());
        assertEquals(PercentHelper.getDecimalValue(50), mockSun.getZenithAngle());
        Vector3f actualDirection = new Vector3f();
        sunLight.getDirection(actualDirection);
        Vector3f expectedDirection = new Vector3f((float) Math.sqrt(2) / 2, -0.5f, -0.5f);
        expectedDirection.normalize();
        VectorTestHelper.assertVectorEquals(expectedDirection, actualDirection);

        mockSun.setRiseAngle(PercentHelper.getDecimalValue(0));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
        sunLight.getDirection(actualDirection);
View Full Code Here

        mockSun.setRiseAngle(PercentHelper.getDecimalValue(0));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
        sunLight.getDirection(actualDirection);
        expectedDirection = new Vector3f(1, 0, 0);
        expectedDirection.normalize();
        VectorTestHelper.assertVectorEquals(expectedDirection, actualDirection);

        mockSun.setRiseAngle(PercentHelper.getDecimalValue(50));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
        sunLight.getDirection(actualDirection);
View Full Code Here

        mockSun.setRiseAngle(PercentHelper.getDecimalValue(50));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
        sunLight.getDirection(actualDirection);
        expectedDirection = new Vector3f(0, -(float) Math.sqrt(2) / 2, -(float) Math.sqrt(2) / 2);
        expectedDirection.normalize();
        VectorTestHelper.assertVectorEquals(expectedDirection, actualDirection);

        mockSun.setRiseAngle(PercentHelper.getDecimalValue(75));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
        sunLight.getDirection(actualDirection);
View Full Code Here

        mockSun.setRiseAngle(PercentHelper.getDecimalValue(75));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
        sunLight.getDirection(actualDirection);
        expectedDirection = new Vector3f(-(float) Math.sqrt(2) / 2, -0.5f, -0.5f);
        expectedDirection.normalize();
        VectorTestHelper.assertVectorEquals(expectedDirection, actualDirection);

        mockSun.setRiseAngle(PercentHelper.getDecimalValue(100));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
        sunLight.getDirection(actualDirection);
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.