Package javax.vecmath

Examples of javax.vecmath.Matrix3f


    solverConstraint.appliedImpulse = 0f;
    solverConstraint.appliedPushImpulse = 0f;
    solverConstraint.penetration = 0f;
   
    Vector3f ftorqueAxis1 = Stack.alloc(Vector3f.class);
    Matrix3f tmpMat = Stack.alloc(Matrix3f.class);
   
    {
      ftorqueAxis1.cross(rel_pos1, solverConstraint.contactNormal);
      solverConstraint.relpos1CrossNormal.set(ftorqueAxis1);
      if (body0 != null) {
View Full Code Here


          Vector3f vel2 = Stack.alloc(Vector3f.class);
          Vector3f frictionDir1 = Stack.alloc(Vector3f.class);
          Vector3f frictionDir2 = Stack.alloc(Vector3f.class);
          Vector3f vec = Stack.alloc(Vector3f.class);

          Matrix3f tmpMat = Stack.alloc(Matrix3f.class);
         
          for (i = 0; i < numManifolds; i++) {
            manifold = manifoldPtr.getQuick(manifold_offset+i);
            colObj0 = (CollisionObject) manifold.getBody0();
            colObj1 = (CollisionObject) manifold.getBody1();
View Full Code Here

      int numpoints = manifoldPtr.getNumContacts();

      BulletStats.gTotalContactPoints += numpoints;
     
      Vector3f tmpVec = Stack.alloc(Vector3f.class);
      Matrix3f tmpMat3 = Stack.alloc(Matrix3f.class);

      Vector3f pos1 = Stack.alloc(Vector3f.class);
      Vector3f pos2 = Stack.alloc(Vector3f.class);
      Vector3f rel_pos1 = Stack.alloc(Vector3f.class);
      Vector3f rel_pos2 = Stack.alloc(Vector3f.class);
      Vector3f vel1 = Stack.alloc(Vector3f.class);
      Vector3f vel2 = Stack.alloc(Vector3f.class);
      Vector3f vel = Stack.alloc(Vector3f.class);
      Vector3f totalImpulse = Stack.alloc(Vector3f.class);
      Vector3f torqueAxis0 = Stack.alloc(Vector3f.class);
      Vector3f torqueAxis1 = Stack.alloc(Vector3f.class);
      Vector3f ftorqueAxis0 = Stack.alloc(Vector3f.class);
      Vector3f ftorqueAxis1 = Stack.alloc(Vector3f.class);
     
      for (int i = 0; i < numpoints; i++) {
        ManifoldPoint cp = manifoldPtr.getContactPoint(i);
        if (cp.getDistance() <= 0f) {
          cp.getPositionWorldOnA(pos1);
          cp.getPositionWorldOnB(pos2);

          rel_pos1.sub(pos1, body0.getCenterOfMassPosition(tmpVec));
          rel_pos2.sub(pos2, body1.getCenterOfMassPosition(tmpVec));

          // this jacobian entry is re-used for all iterations
          Matrix3f mat1 = body0.getCenterOfMassTransform(Stack.alloc(Transform.class)).basis;
          mat1.transpose();

          Matrix3f mat2 = body1.getCenterOfMassTransform(Stack.alloc(Transform.class)).basis;
          mat2.transpose();

          JacobianEntry jac = jacobiansPool.get();
          jac.init(mat1, mat2,
              rel_pos1, rel_pos2, cp.normalWorldOnB,
              body0.getInvInertiaDiagLocal(Stack.alloc(Vector3f.class)), body0.getInvMass(),
View Full Code Here

  /**
   * Calcs the euler angles between the two bodies.
   */
  protected void calculateAngleInfo() {
    Matrix3f mat = Stack.alloc(Matrix3f.class);

    Matrix3f relative_frame = Stack.alloc(Matrix3f.class);
    mat.set(calculatedTransformA.basis);
    MatrixUtil.invert(mat);
    relative_frame.mul(mat, calculatedTransformB.basis);

    matrixToEulerXYZ(relative_frame, calculatedAxisAngleDiff);

    // in euler angle mode we do not actually constrain the angular velocity
    // along the axes axis[0] and axis[2] (although we do use axis[1]) :
View Full Code Here

    calculateAngleInfo();
  }
 
  protected void buildLinearJacobian(/*JacobianEntry jacLinear*/int jacLinear_index, Vector3f normalWorld, Vector3f pivotAInW, Vector3f pivotBInW) {
    Matrix3f mat1 = rbA.getCenterOfMassTransform(Stack.alloc(Transform.class)).basis;
    mat1.transpose();

    Matrix3f mat2 = rbB.getCenterOfMassTransform(Stack.alloc(Transform.class)).basis;
    mat2.transpose();

    Vector3f tmpVec = Stack.alloc(Vector3f.class);
   
    Vector3f tmp1 = Stack.alloc(Vector3f.class);
    tmp1.sub(pivotAInW, rbA.getCenterOfMassPosition(tmpVec));
View Full Code Here

        rbB.getInvInertiaDiagLocal(Stack.alloc(Vector3f.class)),
        rbB.getInvMass());
  }

  protected void buildAngularJacobian(/*JacobianEntry jacAngular*/int jacAngular_index, Vector3f jointAxisW) {
    Matrix3f mat1 = rbA.getCenterOfMassTransform(Stack.alloc(Transform.class)).basis;
    mat1.transpose();

    Matrix3f mat2 = rbB.getCenterOfMassTransform(Stack.alloc(Transform.class)).basis;
    mat2.transpose();

    jacAng[jacAngular_index].init(jointAxisW,
        mat1,
        mat2,
        rbA.getInvInertiaDiagLocal(Stack.alloc(Vector3f.class)),
View Full Code Here

    body2.getVelocityInLocalPoint(rel_pos2, vel2);

    Vector3f vel = Stack.alloc(Vector3f.class);
    vel.sub(vel1, vel2);

    Matrix3f mat1 = body1.getCenterOfMassTransform(Stack.alloc(Transform.class)).basis;
    mat1.transpose();

    Matrix3f mat2 = body2.getCenterOfMassTransform(Stack.alloc(Transform.class)).basis;
    mat2.transpose();

    JacobianEntry jac = jacobiansPool.get();
    jac.init(mat1, mat2,
        rel_pos1, rel_pos2, normal,
        body1.getInvInertiaDiagLocal(Stack.alloc(Vector3f.class)), body1.getInvMass(),
        body2.getInvInertiaDiagLocal(Stack.alloc(Vector3f.class)), body2.getInvMass());

    float jacDiagAB = jac.getDiagonal();
    float jacDiagABInv = 1f / jacDiagAB;

    Vector3f tmp1 = body1.getAngularVelocity(Stack.alloc(Vector3f.class));
    mat1.transform(tmp1);

    Vector3f tmp2 = body2.getAngularVelocity(Stack.alloc(Vector3f.class));
    mat2.transform(tmp2);

    float rel_vel = jac.getRelativeVelocity(
        body1.getLinearVelocity(Stack.alloc(Vector3f.class)),
        tmp1,
        body2.getLinearVelocity(Stack.alloc(Vector3f.class)),
View Full Code Here

        RigidBody groundObject = (RigidBody) wheel_info.raycastInfo.groundObject;

        if (groundObject != null) {
          getWheelTransformWS(i, wheelTrans);

          Matrix3f wheelBasis0 = Stack.alloc(wheelTrans.basis);
          axle.getQuick(i).set(
              wheelBasis0.getElement(0, indexRightAxis),
              wheelBasis0.getElement(1, indexRightAxis),
              wheelBasis0.getElement(2, indexRightAxis));

          Vector3f surfNormalWS = wheel_info.raycastInfo.contactNormalWS;
          float proj = axle.getQuick(i).dot(surfNormalWS);
          tmp.scale(proj, surfNormalWS);
          axle.getQuick(i).sub(tmp);
View Full Code Here

      }

      TransformUtil.planeSpace1(normal[0], normal[1], normal[2]);

      for (int i = 0; i < 3; i++) {
        Matrix3f mat1 = rbA.getCenterOfMassTransform(Stack.alloc(Transform.class)).basis;
        mat1.transpose();

        Matrix3f mat2 = rbB.getCenterOfMassTransform(Stack.alloc(Transform.class)).basis;
        mat2.transpose();

        tmp1.sub(pivotAInW, rbA.getCenterOfMassPosition(tmp));
        tmp2.sub(pivotBInW, rbB.getCenterOfMassPosition(tmp));

        jac[i].init(
View Full Code Here

    // 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);
    basis2.setRow(0, right.x, fwd.x, up.x);
    basis2.setRow(1, right.y, fwd.y, up.y);
    basis2.setRow(2, right.z, fwd.z, up.z);

    Matrix3f wheelBasis = wheel.worldTransform.basis;
    wheelBasis.mul(steeringMat, rotatingMat);
    wheelBasis.mul(basis2);

    wheel.worldTransform.origin.scaleAdd(wheel.raycastInfo.suspensionLength, wheel.raycastInfo.wheelDirectionWS, wheel.raycastInfo.hardPointWS);
  }
View Full Code Here

TOP

Related Classes of javax.vecmath.Matrix3f

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.