Package javax.vecmath

Examples of javax.vecmath.Matrix4f


        CollisionShape groundShape = new StaticPlaneShape(new Vector3f(0, 1, 0), 0.25f);
        // Initialise 'ballShape' to a sphere with a radius of 3 metres.
        CollisionShape ballShape = new SphereShape(3);
        // Initialise 'groundMotionState' to a motion state that simply assigns the origin [0, 0, 0] as the origin of
        // the ground.
        MotionState groundMotionState = new DefaultMotionState(new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), new Vector3f(0, 0, 0), 1.0f)));
        // Initialise 'groundBodyConstructionInfo' to a value that contains the mass, the motion state, the shape, and the inertia (= resistance to change).
        RigidBodyConstructionInfo groundBodyConstructionInfo = new RigidBodyConstructionInfo(0, groundMotionState, groundShape, new Vector3f(0, 0, 0));
        // Set the restitution, also known as the bounciness or spring, to 0.25. The restitution may range from 0.0
        // not bouncy) to 1.0 (extremely bouncy).
        groundBodyConstructionInfo.restitution = 0.25f;
View Full Code Here


        // If a new shape should be created ...
        if (createNewShape) {
            // Create the collision shape (sphere with radius of 3 metres).
            CollisionShape shape = new SphereShape(3);
            // Create the motion state (x and z are the same as the camera's).
            DefaultMotionState motionState = new DefaultMotionState(new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), new Vector3f(camera.x(), 35, camera.z()), 1.0f)));
            // Calculate the inertia (resistance to movement) using the ball's mass of 1 kilogram.
            Vector3f inertia = new Vector3f(0, 0, 0);
            shape.calculateLocalInertia(1.0f, inertia);
            RigidBodyConstructionInfo constructionInfo = new RigidBodyConstructionInfo(1, motionState, shape, inertia);
            constructionInfo.restitution = 0.75f;
            RigidBody rigidBody = new RigidBody(constructionInfo);
            balls.add(rigidBody);
            dynamicsWorld.addRigidBody(rigidBody);
            createNewShape = false;
        }
        // If the controllable ball's position and orientation should be reset ...
        if (resetControlBall) {
            // Set the position of the ball to (0, 50, 0).
            controlBall.setCenterOfMassTransform(new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), new Vector3f(0, 50, 0), 1.0f)));
            // Reset the angular velocity (spinning movement) of the ball.
            controlBall.setAngularVelocity(new Vector3f(0, 0, 0));
            // Reset the linear velocity (x,y,z movement) of the ball.
            controlBall.setLinearVelocity(new Vector3f(0, 0, 0));
            resetControlBall = false;
View Full Code Here

        PhysicsSphere(Vector4f colour, Vector3f position, DynamicsWorld physicsWorld, float mass, float radius, int slices, int stacks) {
            this.colour = colour;
            this.radius = radius;
            this.slices = slices;
            this.stacks = stacks;
            MotionState motion = new DefaultMotionState(new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), position, 1.0f)));
            CollisionShape shape = new SphereShape(radius);
            this.physicsBody = new RigidBody(mass, motion, shape);
            this.physicsWorld = physicsWorld;
            this.physicsWorld.addRigidBody(physicsBody);
            this.renderSphere = new org.lwjgl.util.glu.Sphere();
View Full Code Here

      //mousePos.x += intersect.z;
      //System.out.println("after rotate " +intersect);
    }

    //get the chair matrix
    Matrix4f chairMatrix = new Matrix4f();
    Vec3D chairCentreOfMass = new Vec3D();
    if (GLOBAL.sketchChairs.getCurChair() != null
        && GLOBAL.sketchChairs.getCurChair().rigidBody != null) {
      Transform transform = new Transform();
      GLOBAL.sketchChairs.getCurChair().rigidBody
View Full Code Here

  }

  public Vec2D getPointOnPlaneOld(Vec2D mousePoint, Plane planeIn) {
    //get the chair matrix
    Matrix4f chairMatrix = new Matrix4f();
    Vec3D chairCentreOfMass = new Vec3D();
    if (GLOBAL.sketchChairs.getCurChair() != null
        && GLOBAL.sketchChairs.getCurChair().rigidBody != null) {
      Transform transform = new Transform();
      GLOBAL.sketchChairs.getCurChair().rigidBody
View Full Code Here

   
    //Remembered positions
    //BODYPART_HEAD
    bodies[BodyPart.BODYPART_HEAD.ordinal()].getMotionState()
        .getWorldTransform(transform);
    transform.set(new Matrix4f(0.999522f, -0.02457619f, 0.01875775f,
        103.311295f, 0.03083701f, 0.83602184f, -0.547829f,
        22.693146f * this.scale, -0.0022183368f, 0.5481455f, 0.83638f,
        -1.0370132f * this.scale, 0.0f, 0.0f, 0.0f, 1.0f * this.scale));
    bodies[BodyPart.BODYPART_HEAD.ordinal()]
        .setMotionState(new DefaultMotionState(transform));

    //BODYPART_SPINE
    bodies[BodyPart.BODYPART_SPINE.ordinal()].getMotionState()
        .getWorldTransform(transform);
    transform.setIdentity();
    transform.set(new Matrix4f(0.9932064f, 0.116363324f, 7.786779E-4f,
        104.067566f, -0.1162641f, 0.99203515f, 0.04846615f,
        31.873365f * this.scale, 0.004867207f, -0.048227426f,
        0.99882454f, 0.0021075667f * this.scale, 0.0f, 0.0f, 0.0f,
        1.0f * this.scale));
    bodies[BodyPart.BODYPART_SPINE.ordinal()]
        .setMotionState(new DefaultMotionState(transform));

    //BODYPART_PELVIS
    bodies[BodyPart.BODYPART_PELVIS.ordinal()].getMotionState()
        .getWorldTransform(transform);
    transform.setIdentity();
    transform.set(new Matrix4f(0.9835286f, 0.17898695f, -0.025202362f,
        105.264946f, -0.18059899f, 0.97884035f, -0.09620573f,
        40.34729f * this.scale, 0.007449517f, 0.099172615f, 0.9950424f,
        0.04683579f * this.scale, 0.0f, 0.0f, 0.0f, 1.0f * this.scale));
    bodies[BodyPart.BODYPART_PELVIS.ordinal()]
        .setMotionState(new DefaultMotionState(transform));

    //BODYPART_LEFT_UPPER_LEG
    bodies[BodyPart.BODYPART_LEFT_UPPER_LEG.ordinal()].getMotionState()
        .getWorldTransform(transform);
    transform.setIdentity();
    transform.set(new Matrix4f(0.29188365f, 0.9564537f, -4.4153258E-4f,
        109.79127f, -0.9526396f, 0.29067844f, -0.0893526f,
        44.345417f * this.scale, -0.08533329f, 0.026501186f,
        0.99599993f, 3.9808998f * this.scale, 0.0f, 0.0f, 0.0f,
        1.0f * this.scale));
    bodies[BodyPart.BODYPART_LEFT_UPPER_LEG.ordinal()]
        .setMotionState(new DefaultMotionState(transform));

    //BODYPART_LEFT_LOWER_LEG
    bodies[BodyPart.BODYPART_LEFT_LOWER_LEG.ordinal()].getMotionState()
        .getWorldTransform(transform);
    transform.setIdentity();
    transform.set(new Matrix4f(0.9873329f, -0.15865491f, 0.0015572663f,
        115.62421f, 0.15813647f, 0.98321307f, -0.09102161f,
        52.051834f * this.scale, 0.012909901f, 0.09011489f, 0.9958477f,
        4.6894903f * this.scale, 0.0f, 0.0f, 0.0f, 1.0f * this.scale));
    bodies[BodyPart.BODYPART_LEFT_LOWER_LEG.ordinal()]
        .setMotionState(new DefaultMotionState(transform));

    //RIGHT_UPPER_LEG
    bodies[BodyPart.BODYPART_RIGHT_UPPER_LEG.ordinal()].getMotionState()
        .getWorldTransform(transform);
    transform.setIdentity();
    transform.set(new Matrix4f(0.23838913f, 0.9675928f, -0.08327571f,
        110.01697f, -0.9671425f, 0.22872531f, -0.110996194f,
        44.76596f * this.scale, -0.08835185f, 0.10699976f, 0.9903257f,
        -2.6929f * this.scale, 0.0f, 0.0f, 0.0f, 1.0f * this.scale));
    bodies[BodyPart.BODYPART_RIGHT_UPPER_LEG.ordinal()]
        .setMotionState(new DefaultMotionState(transform));

    //BODYPART_RIGHT_LOWER_LEG
    bodies[BodyPart.BODYPART_RIGHT_LOWER_LEG.ordinal()].getMotionState()
        .getWorldTransform(transform);
    transform.setIdentity();
    transform.set(new Matrix4f(0.9864584f, -0.14225316f, -0.081632055f,
        116.022156f, 0.13265687f, 0.98470926f, -0.11291519f,
        52.043633f * this.scale, 0.09644639f, 0.10055709f, 0.9902456f,
        -1.3562305f * this.scale, 0.0f, 0.0f, 0.0f, 1.0f * this.scale));
    bodies[BodyPart.BODYPART_RIGHT_LOWER_LEG.ordinal()]
        .setMotionState(new DefaultMotionState(transform));

    //BODYPART_RIGHT_FOOT
    bodies[BodyPart.BODYPART_RIGHT_FOOT.ordinal()].getMotionState()
        .getWorldTransform(transform);
    transform.setIdentity();
    transform.set(new Matrix4f(0.00923717f, 0.9967484f, -0.080045804f,
        116.96003f, -0.99355465f, 1.0448694E-4f, -0.11335374f,
        57.707912f * this.scale, -0.11297679f, 0.08057695f, 0.990325f,
        -0.6338565f * this.scale, 0.0f, 0.0f, 0.0f, 1.0f * this.scale));
    bodies[BodyPart.BODYPART_RIGHT_FOOT.ordinal()]
        .setMotionState(new DefaultMotionState(transform));

    //BODYPART_LEFT_FOOT
    bodies[BodyPart.BODYPART_LEFT_FOOT.ordinal()].getMotionState()
        .getWorldTransform(transform);
    transform.setIdentity();
    transform.set(new Matrix4f(-3.4880638E-4f, 0.99999404f, 0.0034378879f,
        116.47286f, -0.9958018f, -3.2663345E-5f, -0.09153569f,
        57.707455f * this.scale, -0.09153503f, -0.0034553856f,
        0.99579585f, 5.203514f * this.scale, 0.0f, 0.0f, 0.0f,
        1.0f * this.scale));
    bodies[BodyPart.BODYPART_LEFT_FOOT.ordinal()]
 
View Full Code Here

  public void printOrigins() {

    Transform transform = new Transform();
    Vector3f origin = new Vector3f();
    Matrix4f matrix = new Matrix4f();

    bodies[BodyPart.BODYPART_HEAD.ordinal()].getMotionState()
        .getWorldTransform(transform);
    transform.getMatrix(matrix);
    System.out.println("//BODYPART_HEAD");
View Full Code Here

        return;

      Transform transform = new Transform();
      MotionState motionstate = rigidBody.getMotionState();
      motionstate.getWorldTransform(transform);
      Matrix4f chairMatrix = new Matrix4f();
      transform.getMatrix(chairMatrix);
      //  LOGGER.debug("current origin"+transform.origin.toString());

      //this is overwritten when settign the chair matrix
      //transform.origin.set(this.centreOfMass.x, this.centreOfMass.y,
View Full Code Here

        return depthPlane;
    } else {
      if (slabPlane != null)
        return slabPlane;
    }
    Matrix4f m = matrixTransform;
    return new Point4f(-m.m20, -m.m21, -m.m22, -m.m23
        + (isDepth ? depthValue : slabValue));
  }
View Full Code Here

    visualRange = angstroms;
  }

  Matrix4f getUnscaledTransformMatrix() {
    //for povray only
    Matrix4f unscaled = new Matrix4f();
    unscaled.setIdentity();
    vectorTemp.set(fixedRotationCenter);
    matrixTemp.setZero();
    matrixTemp.setTranslation(vectorTemp);
    unscaled.sub(matrixTemp);
    matrixTemp.set(matrixRotate);
    unscaled.mul(matrixTemp, unscaled);
    return unscaled;
  }
View Full Code Here

TOP

Related Classes of javax.vecmath.Matrix4f

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.