Package javax.vecmath

Examples of javax.vecmath.Quat4f


    gl.glMatrixMode(GL_PROJECTION);
    gl.glLoadIdentity();
    float rele = ele * 0.01745329251994329547f; // rads per deg
    float razi = azi * 0.01745329251994329547f; // rads per deg

    Quat4f rot = new Quat4f();
    QuaternionUtil.setRotation(rot, cameraUp, razi);

    Vector3f eyePos = new Vector3f();
    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();
    QuaternionUtil.setRotation(roll, right, -rele);

    Matrix3f tmpMat1 = new Matrix3f();
    Matrix3f tmpMat2 = new Matrix3f();
    tmpMat1.set(rot);
View Full Code Here


      linVel.normalize();
      linVel.scale(ShootBoxInitialSpeed);

      Transform worldTrans = body.getWorldTransform(new Transform());
      worldTrans.origin.set(camPos);
      worldTrans.setRotation(new Quat4f(0f, 0f, 0f, 1f));
      body.setWorldTransform(worldTrans);
     
      body.setLinearVelocity(linVel);
      body.setAngularVelocity(new Vector3f(0f, 0f, 0f));
View Full Code Here

      linVel.normalize();
      linVel.scale(ShootBoxInitialSpeed * 0.25f);

      Transform tr = new Transform();
      tr.origin.set(camPos);
      tr.setRotation(new Quat4f(0f, 0f, 0f, 1f));
      body.setWorldTransform(tr);

      body.setLinearVelocity(linVel);
      body.setAngularVelocity(new Vector3f(0f, 0f, 0f));
    }
View Full Code Here

    sign = 1f;
    float dalpha = 2f * (float)Math.PI / NUMRAYS_IN_BAR;
    for (int i=0; i<NUMRAYS_IN_BAR; i++) {
      float alpha = dalpha * i;
      // rotate around by alpha degrees y
      Quat4f q = new Quat4f(0f, 1f, 0f, alpha);
      direction[i].set(1f, 0f, 0f);
      Quat4f tmpQuat = new Quat4f(q);
      QuaternionUtil.mul(tmpQuat, direction[i]);
      direction[i].set(tmpQuat.x, tmpQuat.y, tmpQuat.z);
      //direction[i].set(direction[i]);
      source[i].set(min_x, max_y, z);
      dest[i].scaleAdd(ray_length, direction[i], source[i]);
View Full Code Here

    //#endif //USE_BT_CLOCK

    for (int i=0; i<NUMRAYS_IN_BAR; i++) {
      ClosestConvexResultCallback cb = new ClosestConvexResultCallback(source[i], dest[i]);

      Quat4f qFrom = Stack.alloc(Quat4f.class);
      Quat4f qTo = Stack.alloc(Quat4f.class);
      QuaternionUtil.setRotation(qFrom, new Vector3f(1f, 0f, 0f), 0f);
      QuaternionUtil.setRotation(qTo, new Vector3f(1f, 0f, 0f), 0.7f);

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

      gl.glVertex3f(hit_surface[i].x, hit_surface[i].y, hit_surface[i].z);
      gl.glVertex3f(hit_surface[i].x + normal_scale * normal[i].x, hit_surface[i].y + normal_scale * normal[i].y, hit_surface[i].z + normal_scale * normal[i].z);
    }
    gl.glEnd();
    gl.glColor3f(0f, 1f, 1f);
    Quat4f qFrom = Stack.alloc(Quat4f.class);
    Quat4f qTo = Stack.alloc(Quat4f.class);
    QuaternionUtil.setRotation(qFrom, new Vector3f(1f, 0f, 0f), 0f);
    QuaternionUtil.setRotation(qTo, new Vector3f(1f, 0f, 0f), 0.7f);
    for (int i=0; i<NUMRAYS_IN_BAR; i++) {
      Transform from = Stack.alloc(Transform.class);
      from.basis.set(qFrom);
View Full Code Here

      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);
      transform.setRotation(q);
      tmpTrans.mul(offset, transform);
      bodies[1+2*i] = localCreateRigidBody(1.0f, tmpTrans, shapes[1+2*i]);

 
View Full Code Here

    // up.normalize();

    // rotate around steering over de wheelAxleWS
    float steering = wheel.steering;

    Quat4f steeringOrn = Stack.alloc(Quat4f.class);
    QuaternionUtil.setRotation(steeringOrn, up, steering); //wheel.m_steering);
    Matrix3f steeringMat = Stack.alloc(Matrix3f.class);
    MatrixUtil.setRotation(steeringMat, steeringOrn);

    Quat4f rotatingOrn = Stack.alloc(Quat4f.class);
    QuaternionUtil.setRotation(rotatingOrn, right, -wheel.rotation);
    Matrix3f rotatingMat = Stack.alloc(Matrix3f.class);
    MatrixUtil.setRotation(rotatingMat, rotatingOrn);

    Matrix3f basis2 = Stack.alloc(Matrix3f.class);
View Full Code Here

    if (twistSpan >= 0f) {
      //Vector3f b2Axis2 = Stack.alloc(Vector3f.class);
      rbBFrame.basis.getColumn(1, b2Axis2);
      getRigidBodyB().getCenterOfMassTransform(tmpTrans).basis.transform(b2Axis2);

      Quat4f rotationArc = QuaternionUtil.shortestArcQuat(b2Axis1, b1Axis1, Stack.alloc(Quat4f.class));
      Vector3f TwistRef = QuaternionUtil.quatRotate(rotationArc, b2Axis2, Stack.alloc(Vector3f.class));
      float twist = ScalarUtil.atan2Fast(TwistRef.dot(b1Axis3), TwistRef.dot(b1Axis2));

      float lockedFreeFactor = (twistSpan > 0.05f) ? limitSoftness : 0f;
      if (twist <= -twistSpan * lockedFreeFactor) {
View Full Code Here

    rbAFrame.basis.setRow(0, rbAxisA1.x, rbAxisA2.x, axisInA.x);
    rbAFrame.basis.setRow(1, rbAxisA1.y, rbAxisA2.y, axisInA.y);
    rbAFrame.basis.setRow(2, rbAxisA1.z, rbAxisA2.z, axisInA.z);

    Quat4f rotationArc = QuaternionUtil.shortestArcQuat(axisInA, axisInB, Stack.alloc(Quat4f.class));
    Vector3f rbAxisB1 = QuaternionUtil.quatRotate(rotationArc, rbAxisA1, Stack.alloc(Vector3f.class));
    Vector3f rbAxisB2 = Stack.alloc(Vector3f.class);
    rbAxisB2.cross(axisInB, rbAxisB1);

    rbBFrame.origin.set(pivotInB);
View Full Code Here

TOP

Related Classes of javax.vecmath.Quat4f

Copyright © 2018 www.massapicom. 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.