Package javax.vecmath

Examples of javax.vecmath.Quat4d


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


        }
    }
   
    private void applyUserForces() {
        if (pressingUp) {
            Quat4d q = new Quat4d();
            q.set(new AxisAngle4d(1, 0, 0, -0.0002 * speed.length()));
            rotationSpeed.mul(q);
        }
        if (pressingDown) {
            Quat4d q = new Quat4d();
            q.set(new AxisAngle4d(1, 0, 0, 0.0003 * speed.length()));
            rotationSpeed.mul(q);
        }
        if (pressingRight) {
            Quat4d q = new Quat4d();
            q.set(new AxisAngle4d(0, 0, 1, 0.0007 * speed.length()));
            rotationSpeed.mul(q);
        }
        if (pressingLeft) {
            Quat4d q = new Quat4d();
            q.set(new AxisAngle4d(0, 0, 1, -0.0007 * speed.length()));
            rotationSpeed.mul(q);
        }
        if (pressingRudderRight) {
            Quat4d q = new Quat4d();
            q.set(new AxisAngle4d(0, 1, 0, 0.0003 * speed.length()));
            rotationSpeed.mul(q);
        }
        if (pressingRudderLeft) {
            Quat4d q = new Quat4d();
            q.set(new AxisAngle4d(0, 1, 0, -0.0003 * speed.length()));
            rotationSpeed.mul(q);
        }
    }
View Full Code Here

        destination0.add(source);
        Vector3d diff = new Vector3d(destination0);
        destination0.y = -destination0.y;
        double angle = destination0.angle(new Vector3d(0.0, -1.0, 0.0));
        destination0.cross(destination0, new Vector3d(0.0, -1.0, 0.0));
        Quat4d rot = new Quat4d();
        rot.set(new AxisAngle4d(destination0, angle));
        diff.scale(.5);
        destination.add(diff);

        TransformGroup tg = new TransformGroup(new Transform3D(rot, new Vector3d(destination), 1.0));
        tg.addChild(link);
View Full Code Here

            Cylinder yAxis = new Cylinder((float) 0.01, (float) 6.0);
            _userTransformation.addChild(yAxis);

            Cylinder xAxis = new Cylinder((float) 0.01, (float) 6.0);
            Transform3D rotation = new Transform3D();
            Quat4d quat = new Quat4d();
            quat.set(new AxisAngle4d(0.0, 0.0, 1.0, Math.PI / 2.0));
            rotation.set(quat);

            TransformGroup xAxisGroup = new TransformGroup(rotation);
            xAxisGroup.addChild(xAxis);
            _userTransformation.addChild(xAxisGroup);

            Cylinder zAxis = new Cylinder((float) 0.01, (float) 6.0);
            Transform3D rotation2 = new Transform3D();
            Quat4d quat2 = new Quat4d();
            quat2.set(new AxisAngle4d(1.0, 0.0, 0.0, Math.PI / 2.0));
            rotation2.set(quat2);

            TransformGroup zAxisGroup = new TransformGroup(rotation2);
            zAxisGroup.addChild(zAxis);
            _userTransformation.addChild(zAxisGroup);
View Full Code Here

                _xAxis = (float) axis.getElementAt(0, 0);
                _yAxis = (float) axis.getElementAt(0, 1);
                _zAxis = (float) axis.getElementAt(0, 2);

                Quat4d quat = new Quat4d();

                if (_isAccumulating()) {
                    _accumulatedAngle = in + _accumulatedAngle;
                    quat.set(new AxisAngle4d(_xAxis, _yAxis, _zAxis,
                            _accumulatedAngle));
                } else {
                    quat.set(new AxisAngle4d(_xAxis, _yAxis, _zAxis, in
                            + originalAngle));
                }

                _rotation.set(quat);
                _middleRotate.setTransform(_rotation);
View Full Code Here

        Transform3D topTransform = new Transform3D();
        topTransform.setTranslation(new Vector3d(_baseX, _baseY, _baseZ));
        _topTranslate.setTransform(topTransform);

        Quat4d quaternion = new Quat4d();
        quaternion.set(new AxisAngle4d(_xAxis, _yAxis, _zAxis, originalAngle));
        _rotation.set(quaternion);
        _middleRotate.setTransform(_rotation);

        Transform3D bottomTransform = new Transform3D();
        bottomTransform.setTranslation(new Vector3d(-_baseX, -_baseY, -_baseZ));
View Full Code Here

            axisX = ((DoubleToken) axisToken.getElement(0)).doubleValue();
            axisY = ((DoubleToken) axisToken.getElement(1)).doubleValue();
            axisZ = ((DoubleToken) axisToken.getElement(2)).doubleValue();
            angle = (angleToken).doubleValue();

            Quat4d quaternion = new Quat4d();
            quaternion.set(new AxisAngle4d(axisX, axisY, axisZ, angle));

            Vector3d vector = new Vector3d(xPosition, yPosition, zPosition);
            Transform3D t = new Transform3D(quaternion, vector, 1.0);
            TransformGroup group = _simpleUniverse.getViewingPlatform()
                    .getViewPlatformTransform();
View Full Code Here

        axisX = ((DoubleToken) _axis.getElement(0)).doubleValue();
        axisY = ((DoubleToken) _axis.getElement(1)).doubleValue();
        axisZ = ((DoubleToken) _axis.getElement(2)).doubleValue();
        angle = (_angle).doubleValue();

        Quat4d quaternion = new Quat4d();
        quaternion.set(new AxisAngle4d(axisX, axisY, axisZ, angle));

        Vector3d vector = new Vector3d(xPosition, yPosition, zPosition);
        Transform3D t = new Transform3D(quaternion, vector, 1.0);
        TransformGroup group = _simpleUniverse.getViewingPlatform()
                .getViewPlatformTransform();
View Full Code Here

     * @param transform3D is supposed to be normalized
     * @param axis
     * @return
     */
    public static double getRotationFromTransform(Transform3D transform3D, Axis axis) {
        Quat4d rotationQuat = new Quat4d();
        transform3D.get(rotationQuat);
        double angle = 2 * Math.acos(rotationQuat.w);
        switch (axis) {
        case X:
            if (rotationQuat.x < 0) {
View Full Code Here

     * @param transform3D is supposed to be normalized
     * @param axis
     * @return
     */
    public static double getRotationFromTransform(Transform3D transform3D, Axis axis) {
        Quat4d rotationQuat = new Quat4d();
        transform3D.get(rotationQuat);
        double angle = 2 * Math.acos(rotationQuat.w);
        switch (axis) {
        case X:
            if (rotationQuat.x < 0) {
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.