Package javax.vecmath

Examples of javax.vecmath.Quat4d


//        this.scale *= in.scale;
//        this.translation.addLocal(rotation.mult(in.translation).multLocal(in.scale));
//        this.rotation.multLocal(in.rotation);

        // Correctly calculate the multiplication.
        Quat4d q = new Quat4d(rotation.x, rotation.y, rotation.z, rotation.w);
        Vector3d t = new Vector3d(translation.x, translation.y, translation.z);
        Matrix4d m = new Matrix4d(q,t,scale);

        Quat4d q1 = new Quat4d(in.rotation.x, in.rotation.y, in.rotation.z, in.rotation.w);
        Vector3d t1 = new Vector3d(in.translation.x, in.translation.y, in.translation.z);
        Matrix4d m1 = new Matrix4d(q1,t1,in.scale);

        m.mul(m1);

View Full Code Here


//
//        rotation.fromRotationMatrix(rot);

        // Correctly compute the inversion, use Vecmath as the matrix invert
        // in JME does not function when scale!=1
        Quat4d q = new Quat4d(rotation.x, rotation.y, rotation.z, rotation.w);
        Vector3d t = new Vector3d(translation.x, translation.y, translation.z);
        Matrix4d m = new Matrix4d(q,t,scale);
        m.invert();

        m.get(q);
View Full Code Here

    private void align() {
        if (Math.abs(attackAngle) < 0.25) {
            return;
        }
        Quat4d quat = new Quat4d();
        quat.set(new AxisAngle4d(0, 0, 1, attackAngle * 0.01));
        rotationSpeed.mul(quat);
    }
View Full Code Here

        quat.set(new AxisAngle4d(0, 0, 1, attackAngle * 0.01));
        rotationSpeed.mul(quat);
    }

    public void launch() {
        setRotationSpeed(new Quat4d(0,0,0,1));
        Quat4d q = new Quat4d();
        double angle= -Math.PI/2.0-(rand.nextDouble()-0.5);
        q.set(new AxisAngle4d(0, 0, 1, angle));
        setOrientation(q);
        orientationForward = QuatUtil.rotateVector(FORWARD, orientation);
        orientationForward.scale(8);
        setSpeed(orientationForward);
    }
View Full Code Here

    @Override
    public void stepSimulation() {
        if(state==BombState.ACTIVE){
            bombPhysicalObject.stepSimulation();
            Quat4d q = bombPhysicalObject.getOrientation();
            rotate.setAxis(new Point3D(q.x, q.y, q.z));
            double radians = Math.acos(q.w) * 2;
            rotate.setAngle(Math.toDegrees(radians));

            Vector3d place = bombPhysicalObject.getPlace();
View Full Code Here

    private void setPlacement() {  
        Vector3d place = planePhysicalObject.getPlace();
        setTranslateX(place.getX());
        setTranslateY(place.getY());
       
        Quat4d q = planePhysicalObject.getOrientation();           
        double radians = Math.acos(q.w) * 2;
        if(!Double.isNaN(radians)){
            rotate.setAxis(new Point3D(q.x, q.y, q.z));          
            rotate.setAngle(Math.toDegrees(radians));
        }       
View Full Code Here

    private double attackAngle;
    private double slidingAngle;
    private double speedSquared;

    public PlanePhysicalObject() {
        Quat4d initialQuat = new Quat4d();
        initialQuat.set(new AxisAngle4d(0, 1, 0, Math.toRadians(90)));
        setOrientation(initialQuat);
        setPlace(new Vector3d(0, 200, 1000));
        setSpeed(new Vector3d(10, -2, 0));
    }
View Full Code Here

        drag.scale(-0.0005);
        speed.add(drag);
    }

    private void angularDrag() {
        Quat4d zero = new Quat4d(0, 0, 0, 1);
        zero.interpolate(rotationSpeed, -0.1);
        rotationSpeed.mul(zero);
    }
View Full Code Here

        speed.normalize();
        speed.scale(speedLegthBefore);
    }

    private void alignLeftRight() {
        Quat4d quat = new Quat4d();
        quat.set(new AxisAngle4d(0, -1, 0, slidingAngle * -0.0001 * speedSquared));
        rotationSpeed.mul(quat);
    }
View Full Code Here

        quat.set(new AxisAngle4d(0, -1, 0, slidingAngle * -0.0001 * speedSquared));
        rotationSpeed.mul(quat);
    }

    private void dihedral() {
        Quat4d quat = new Quat4d();
        quat.set(new AxisAngle4d(0, 0, 1, slidingAngle * -0.0001 * speedSquared));
        rotationSpeed.mul(quat);
    }
View Full Code Here

TOP

Related Classes of javax.vecmath.Quat4d

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.