Package javax.vecmath

Examples of javax.vecmath.Vector3d


import javax.vecmath.Vector3d;

public class VectorUtils {

  public static Vector3d getProjection(Vector3d p, Vector3d v){
    Vector3d right= new Vector3d();   
    right.cross(p, v);
    Vector3d projection= new Vector3d();
    projection.cross(right, p);
    return projection;
  }
View Full Code Here


    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

        alignUpDown()
    }
   
    public void groundedSimulationStep(){
        calculateValues();       
        Vector3d newSpeed= new Vector3d(speed.x, 0, speed.z);
        double length= newSpeed.length();       
        newSpeed.normalize();
        newSpeed.scale(length-0.1);              
        Vector3d newPlace= new Vector3d(place.x, 700, place.z);
        setSpeed(newSpeed);
        setPlace(newPlace);
        angularDrag();    
        dihedral();
        alignUpDown();
View Full Code Here

        slidingAngle = orientationLeft.angle(speed) - Math.PI / 2.0;
        speedSquared = speed.length()*speed.length();
    }

    private void airDrag() {
        Vector3d drag = new Vector3d(speed);
        drag.normalize();
        drag.scale(Math.abs(attackAngle)+0.1)
        drag.scale(speedSquared);
        drag.scale(-0.0005);
        speed.add(drag);
    }
View Full Code Here

        setUserData(aaa);
    }

    public ArtilleryAttackModel(int type, Coords c, IGame game, TileTextureManager tileManager) {
        IHex hex = game.getBoard().getHex(c);
        Vector3d tl = new Vector3d(BoardModel.getHexLocation(c, hex.surface()));
        Transform3D t = new Transform3D();
        if (type == TilesetManager.ARTILLERY_INCOMING) {
            // FIXME: nearly invisible on map view
            t.rotX(Math.PI/2);
            tl.z += BoardModel.HEX_DIAMETER;
        }
        t.setScale(new Vector3d(2*BoardModel.HEX_SIDE_LENGTH, BoardModel.HEX_DIAMETER, 1.0));
        t.setTranslation(tl);
        TransformGroup anim = new TransformGroup();
        anim.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
        anim.addChild(tileManager.getArtilleryTarget(type));
        TransformGroup tg = new TransformGroup(t);
View Full Code Here

        addChild(ti);

        Cylinder link = new Cylinder(1.5f, (float)source.distance(destination));
        link.setAppearance(base);

        Vector3d destination0 = new Vector3d(destination);
        destination0.negate();
        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);
        addChild(tg);
        setCapability(ALLOW_DETACH);
        setPickable(false);
    }
View Full Code Here

        }

        MultiTransformGroup mtg = universe.getViewingPlatform().getMultiTransformGroup();

        mtg.getTransformGroup(0).setTransform(
            new Transform3D(rotfix, new Vector3d(BoardModel.getHexLocation(c, hex.getElevation())), 1.0)
        );
    }
View Full Code Here

        ttrans.rotX(Math.PI/3);
        tiltTrans.setTransform(ttrans);

        TransformGroup zoomTrans = mtg.getTransformGroup(4);
        Transform3D ztrans = new Transform3D();
        ztrans.setTranslation(new Vector3d(0.0, 0.0, 20*BoardModel.HEX_DIAMETER));
        zoomTrans.setTransform(ztrans);
    }
View Full Code Here

        Transform3D ttrans = new Transform3D();
        ttrans.rotX(Math.PI/3);
        tiltTrans.setTransform(ttrans);

        TransformGroup zoomTrans = mtg.getTransformGroup(4);
        zoomTrans.setTransform(new Transform3D(new Quat4d(), new Vector3d(0.0, 0.0, 20*BoardModel.HEX_DIAMETER), 1.0));

        Transform3D etrans = new Transform3D();
        etrans.lookAt(new Point3d(0, 0, 0), new Point3d(0, 0, -1), new Vector3d(0, 1, 0));
        etrans.invert();
        mtg.getTransformGroup(5).setTransform(etrans);

        MouseWheelZoom behavior0 = new MouseWheelZoom(zoomTrans);
        behavior0.setFactor(-BoardModel.HEX_DIAMETER/3);
View Full Code Here

        TransformGroup zoomTrans = mtg.getTransformGroup(4);

        Transform3D trans = new Transform3D();
        zoomTrans.getTransform(trans);

        Vector3d t = new Vector3d();
        trans.get(t);
        t.z -= steps*4*BoardModel.HEX_DIAMETER;
        trans.setTranslation(t);

        zoomTrans.setTransform(trans);
View Full Code Here

TOP

Related Classes of javax.vecmath.Vector3d

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.