Package javax.vecmath

Examples of javax.vecmath.Vector3f.sub()


            Vector3f pt2 = vectorsPool.get();
            pt2.scaleAdd(vecLen, vec1, planeOrigin);

            Vector3f pt3 = vectorsPool.get();
            pt3.scale(vecLen, vec1);
            pt3.sub(planeOrigin, pt3);
           
            gl.glBegin(gl.GL_LINES);
            gl.glVertex3f(pt0.x,pt0.y,pt0.z);
            gl.glVertex3f(pt1.x,pt1.y,pt1.z);
            gl.glVertex3f(pt2.x,pt2.y,pt2.z);
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 void mouseFunc(int button, int state, int x, int y) {
    //printf("button %i, state %i, x=%i,y=%i\n",button,state,x,y);
View Full Code Here

                Vector3f impulse = new Vector3f(rayTo);
                impulse.normalize();
                float impulseStrength = 10f;
                impulse.scale(impulseStrength);
                Vector3f relPos = new Vector3f();
                relPos.sub(rayCallback.hitPointWorld, body.getCenterOfMassPosition(new Vector3f()));
                body.applyImpulse(impulse, relPos);
              }
            }
          }
        }
View Full Code Here

                  pickConstraint = p2p;
                  // save mouse position for dragging
                  BulletStats.gOldPickingPos.set(rayTo);
                  Vector3f eyePos = new Vector3f(cameraPosition);
                  Vector3f tmp = new Vector3f();
                  tmp.sub(pickPos, eyePos);
                  BulletStats.gOldPickingDist = tmp.length();
                  // very weak constraint for picking
                  p2p.setting.tau = 0.1f;
                }
              }
View Full Code Here

        // keep it at the same picking distance

        Vector3f newRayTo = new Vector3f(getRayTo(x, y));
        Vector3f eyePos = new Vector3f(cameraPosition);
        Vector3f dir = new Vector3f();
        dir.sub(newRayTo, eyePos);
        dir.normalize();
        dir.scale(BulletStats.gOldPickingDist);

        Vector3f newPos = new Vector3f();
        newPos.add(eyePos, dir);
View Full Code Here

      boneOrigin.set(cos*(bodySize+0.5f*legLength), height, sin*(bodySize+0.5f*legLength));
      transform.origin.set(boneOrigin);

      // thigh
      Vector3f toBone = new Vector3f(boneOrigin);
      toBone.sub(root);
      toBone.normalize();
      Vector3f axis = new Vector3f();
      axis.cross(toBone,up);
      Quat4f q = new Quat4f();
      QuaternionUtil.setRotation(q, axis, BulletGlobals.SIMD_HALF_PI);
View Full Code Here

    //#else
    cameraPosition.y = (15.0f*cameraPosition.y + cameraTargetPosition.y + cameraHeight) / 16.0f;
    //#endif

    Vector3f camToObject = new Vector3f();
    camToObject.sub(cameraTargetPosition, cameraPosition);

    // keep distance between min and max distance
    float cameraDistance = camToObject.length();
    float correctionFactor = 0f;
    if (cameraDistance < minCameraDistance)
View Full Code Here

    //#else
    cameraPosition.y = (15.0f*cameraPosition.y + cameraTargetPosition.y + cameraHeight) / 16.0f;
    //#endif

    Vector3f camToObject = new Vector3f();
    camToObject.sub(cameraTargetPosition, cameraPosition);

    // keep distance between min and max distance
    float cameraDistance = camToObject.length();
    float correctionFactor = 0f;
    if (cameraDistance < minCameraDistance)
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.