Package javax.vecmath

Examples of javax.vecmath.Vector3f.sub()


            Transform controlBallTransform = new Transform();
            controlBall.getMotionState().getWorldTransform(controlBallTransform);
            Vector3f controlBallLocation = controlBallTransform.origin;
            Vector3f cameraPosition = new Vector3f(camera.x(), camera.y(), camera.z());
            Vector3f force = new Vector3f();
            force.sub(cameraPosition, controlBallLocation);
            controlBall.activate(true);
            controlBall.applyCentralForce(force);
        }
        if (createNewShape) {
            CollisionShape shape = new SphereShape(3.0f);
View Full Code Here


            Vector3f controlBallLocation = controlBallTransform.origin;
            Vector3f cameraPosition = new Vector3f(camera.x(), camera.y(), camera.z());
            // Calculate the force that is applied to the controllable ball as following:
            //  force = cameraPosition - controlBallLocation
            Vector3f force = new Vector3f();
            force.sub(cameraPosition, controlBallLocation);
            // Wake the controllable ball if it is sleeping.
            controlBall.activate(true);
            // Apply the force to the controllable ball.
            controlBall.applyCentralForce(force);
        }
View Full Code Here

    float tanFov = (top - bottom) * 0.5f / nearPlane;
    float fov = 2f * (float) Math.atan(tanFov);

    Vector3f rayFrom = new Vector3f(getCameraPosition());
    Vector3f rayForward = new Vector3f();
    rayForward.sub(getCameraTargetPosition(), getCameraPosition());
    rayForward.normalize();
    float farPlane = 10000f;
    rayForward.scale(farPlane);

    Vector3f rightOffset = new Vector3f();
View Full Code Here

    Vector3f tmp2 = new Vector3f();
    tmp1.scale(0.5f, hor);
    tmp2.scale(0.5f, vertical);

    Vector3f rayTo = new Vector3f();
    rayTo.sub(rayToCenter, tmp1);
    rayTo.add(tmp2);

    tmp1.scale(x, dHor);
    tmp2.scale(y, dVert);
View Full Code Here

    tmp1.scale(x, dHor);
    tmp2.scale(y, dVert);

    rayTo.add(tmp1);
    rayTo.sub(tmp2);
    return rayTo;
  }

  public Vector3f getRayToCustom(float x, float y) {
    Vector3f rayTo = new Vector3f(x, y, -1000);
View Full Code Here

  Vector3f v1 = new Vector3f();
  Vector3f v2 = new Vector3f();

  // Must compute normal
  v1.sub(p2, p1);
  v2.sub(p2, p3);
  normal.cross(v1, v2);
  normal.negate();

  float length = normal.length();
View Full Code Here

      float yTransStart = navigationOffset.y;
      float yTransDelta = yTrans - yTransStart;
      float degreeStep = degrees / totalSteps;
      Vector3f aaStepCenter = new Vector3f();
      aaStepCenter.set(ptMoveToCenter);
      aaStepCenter.sub(navigationCenter);
      aaStepCenter.scale(1f / totalSteps);
      Point3f centerStart = new Point3f(navigationCenter);
      for (int iStep = 1; iStep < totalSteps; ++iStep) {

        navigating = true;
View Full Code Here

    Point3f pt0s = new Point3f();
    Point3f pt1s = new Point3f();
    matrixRotate.transform(pt0, pt0s);
    matrixRotate.transform(pt1, pt1s);
    Vector3f vPath = new Vector3f(pt0s);
    vPath.sub(pt1s);
    Vector3f v = new Vector3f(0, 0, 1);
    float angle = vPath.angle(v);
    v.cross(vPath, v);
    if (angle != 0)
      navigate(0, v, (float) (angle * degreesPerRadian));
 
View Full Code Here

        && (!isSpin || endDegrees == 0 || Float.isNaN(degreesPerSecond) || degreesPerSecond == 0)
        && (isSpin || endDegrees == 0))
      return;

    Vector3f axis = new Vector3f(point2);
    axis.sub(point1);
    if (isClockwise)
      axis.scale(-1f);
    internalRotationCenter.set(point1);
    rotationAxis.set(axis);
    rotationRate = degreesPerSecond;
View Full Code Here

            // plane(<point1>,<point2>) or
            // plane(<point1>,<point2>,false)
            pt3 = new Point3f(pt1);
            pt3.add(pt2);
            pt3.scale(0.5f);
            norm.sub(pt1);
            norm.normalize();
          } else {
            // plane(<point1>,<vLine>,true)
          }
          return addX(Measure.getPlaneThroughPoint(pt3, norm));
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.