Package javax.vecmath

Examples of javax.vecmath.Matrix3f


      totalMass += masses[k];
    }
    center.scale(1f / totalMass);
    principal.origin.set(center);

    Matrix3f tensor = Stack.alloc(Matrix3f.class);
    tensor.setZero();

    for (int k = 0; k < n; k++) {
      Vector3f i = Stack.alloc(Vector3f.class);
      children.getQuick(k).childShape.calculateLocalInertia(masses[k], i);

      Transform t = children.getQuick(k).transform;
      Vector3f o = Stack.alloc(Vector3f.class);
      o.sub(t.origin, center);

      // compute inertia tensor in coordinate system of compound shape
      Matrix3f j = Stack.alloc(Matrix3f.class);
      j.transpose(t.basis);

      j.m00 *= i.x;
      j.m01 *= i.x;
      j.m02 *= i.x;
      j.m10 *= i.y;
      j.m11 *= i.y;
      j.m12 *= i.y;
      j.m20 *= i.z;
      j.m21 *= i.z;
      j.m22 *= i.z;

      j.mul(t.basis, j);

      // add inertia tensor
      tensor.add(j);

      // compute inertia tensor of pointmass at o
      float o2 = o.lengthSquared();
      j.setRow(0, o2, 0, 0);
      j.setRow(1, 0, o2, 0);
      j.setRow(2, 0, 0, o2);
      j.m00 += o.x * -o.x;
      j.m01 += o.y * -o.x;
      j.m02 += o.z * -o.x;
      j.m10 += o.x * -o.y;
      j.m11 += o.y * -o.y;
 
View Full Code Here


    halfExtents.x += getMargin();
    halfExtents.y += getMargin();
    halfExtents.z += getMargin();

    Matrix3f abs_b = Stack.alloc(Matrix3f.class);
    abs_b.set(t.basis);
    MatrixUtil.absolute(abs_b);

    Vector3f center = t.origin;
    Vector3f extent = Stack.alloc(Vector3f.class);

    abs_b.getRow(0, tmp);
    extent.x = tmp.dot(halfExtents);
    abs_b.getRow(1, tmp);
    extent.y = tmp.dot(halfExtents);
    abs_b.getRow(2, tmp);
    extent.z = tmp.dot(halfExtents);

    aabbMin.sub(center, extent);
    aabbMax.add(center, extent);
  }
View Full Code Here

    /*Vector3f localOrigin(0, 0, 0);
    localOrigin[m_upAxis] = (m_minHeight + m_maxHeight) * 0.5f; XXX
    localOrigin *= m_localScaling;*/

    Matrix3f abs_b = Stack.alloc(t.basis);
    MatrixUtil.absolute(abs_b);

    Vector3f tmp = Stack.alloc(Vector3f.class);

    Vector3f center = Stack.alloc(t.origin);
    Vector3f extent = Stack.alloc(Vector3f.class);
    abs_b.getRow(0, tmp);
    extent.x = tmp.dot(halfExtents);
    abs_b.getRow(1, tmp);
    extent.y = tmp.dot(halfExtents);
    abs_b.getRow(2, tmp);
    extent.z = tmp.dot(halfExtents);

    Vector3f margin = Stack.alloc(Vector3f.class);
    margin.set(getMargin(), getMargin(), getMargin());
    extent.add(margin);
View Full Code Here

      if ((timer.getTime() - lastAngularDamping) > dampingInterval) {
        Vector3f vec = vehicleControl.getAngularVelocity();
        float dampingFactor = .1f;

        // ////////////
        Matrix3f mat = new Matrix3f();
        vehicleControl.getObjectId().getInvInertiaTensorWorld(mat);
        javax.vecmath.Vector3f vector3f = new javax.vecmath.Vector3f(new float[] { 0f, dampingFactor, 0f });
        mat.transform(vector3f);
        javax.vecmath.Vector3f interpolatedVec = new javax.vecmath.Vector3f();
        vehicleControl.getObjectId().getAngularVelocity(interpolatedVec).add(vector3f);
        // ////////////

        // diff berechnen (pos)
View Full Code Here

  public static void transform(Vector2f vector, Matrix3f matrix) {
   
  }
 
  public static Matrix3f newMatrix() {
    Matrix3f matrix = new Matrix3f();
    matrix.setIdentity();
    return matrix;
  }
View Full Code Here

        result.mul(m, vm);
        return result;
    }

    public static Matrix3f calcNormalMatrix(Matrix4f mv) {
        Matrix3f result = new Matrix3f();
        result.m00 = mv.m00;
        result.m10 = mv.m10;
        result.m20 = mv.m20;
        result.m01 = mv.m01;
        result.m11 = mv.m11;
        result.m21 = mv.m21;
        result.m02 = mv.m02;
        result.m12 = mv.m12;
        result.m22 = mv.m22;

        result.invert();
        result.transpose();
        return result;
    }
View Full Code Here

        VoxelWorldShape worldShape = new VoxelWorldShape(wrapper);

        liquidWrapper = new PhysicsLiquidWrapper(world);
        VoxelWorldShape liquidShape = new VoxelWorldShape(liquidWrapper);

        Matrix3f rot = new Matrix3f();
        rot.setIdentity();
        DefaultMotionState blockMotionState = new DefaultMotionState(new Transform(new Matrix4f(rot, new Vector3f(0, 0, 0), 1.0f)));
        RigidBodyConstructionInfo blockConsInf = new RigidBodyConstructionInfo(0, blockMotionState, worldShape, new Vector3f());
        BulletRigidBody rigidBody = new BulletRigidBody(blockConsInf);
        rigidBody.rb.setCollisionFlags(CollisionFlags.STATIC_OBJECT | rigidBody.rb.getCollisionFlags());
        short mask = (short) (~(CollisionFilterGroups.STATIC_FILTER | StandardCollisionGroup.LIQUID.getFlag()));
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.