Package javax.vecmath

Examples of javax.vecmath.Vector3d


  if( boundsIsInfinite ) {
      return true;
  }

  double l2oc,rad2,tca,t2hc,mag;
  Vector3d dir = new Vector3d()// normalized direction of ray
  Point3d oc  = new Point3d()// vector from sphere center to ray origin

  oc.x = center.x - origin.x;
  oc.y = center.y - origin.y;
  oc.z = center.z - origin.z;
View Full Code Here


            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();
            setTranslateX(place.getX());
            setTranslateY(place.getY());

            Point2d planePoint= new Point2d(world.getPlane().getTranslateX(), world.getPlane().getTranslateY());
            if(isTouching(planePoint)){
                switchToExploding();
            }
View Full Code Here

        launchSound.play();
        double planeX= world.getPlane().getTranslateX();
        double deltaY= 1000- world.getPlane().getTranslateY();
        double planeSpeedX= world.getPlane().getPhysicalObject().getSpeed().x;
        double launchX= planeX+(deltaY*planeSpeedX*0.15);
        bombPhysicalObject.setPlace(new Vector3d(launchX, 1000, 1000));
        bombPhysicalObject.launch();
    }
View Full Code Here

    private void thrust(){
        if(speed.length()>10){
            return;
        }
        Vector3d thrust = new Vector3d(speed);
        thrust.normalize();
        thrust.scale(0.1);
        speed.add(thrust);
    }
View Full Code Here

   
    private void lift() {
        if (getPlace().y < -100) {
            return;
        }
        Vector3d lift = VectorUtils.getProjection(speed, orientationUp);
        lift.normalize();
        double factor;
        if(Math.abs(attackAngle)<0.25){
            factor= attackAngle;
        }
        else{
            factor= 0;
        }
        lift.scale(factor);
        lift.scale(Math.cos(slidingAngle));
        lift.scale(speedSquared);
        lift.scale(0.02);

        double speedLegthBefore= speed.length();
        speed.add(lift);
        speed.normalize();
        speed.scale(speedLegthBefore);
View Full Code Here

        rotationSpeed.mul(quat);
    }

    private void bounce(){
        if(getPlace().y>700){
            Vector3d newSpeed= new Vector3d(speed.x, -Math.abs(speed.y), speed.z);
            setSpeed(newSpeed);
        }
    }
View Full Code Here

        planePhysicalObject.stepSimulation();
        setPlacement();
    }

    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));          
View Full Code Here

        }       
    }

    private void switchToGrounded() {
        state = PlaneState.GROUNDED;
        Vector3d newSpeed = new Vector3d(planePhysicalObject.getSpeed().x, 0, planePhysicalObject.getSpeed().z);
        Vector3d newPlace = new Vector3d(planePhysicalObject.getPlace().x, 700, planePhysicalObject.getPlace().z);
        planePhysicalObject.setSpeed(newSpeed);
        planePhysicalObject.setPlace(newPlace);
    }
View Full Code Here

        planePhysicalObject.setPlace(newPlace);
    }

    private void switchToDead() {
        state = PlaneState.DEAD;
        planePhysicalObject.setSpeed(new Vector3d(0, 0, 0));
        world.getHud().getStartButton().setDisable(false);
        world.getSubmitScorePane().setTranslateX(getTranslateX()-100);
        world.getSubmitScorePane().setVisible(true);
        world.getSubmitScorePane().setScore(world.getHud().getTime());
        world.getSubmitScorePane().getNameTf().requestFocus();
View Full Code Here

        double tempY = 2 * q.x * q.y * v.getX() + q.y * q.y * v.getY() + 2 * q.z * q.y * v.getZ() + 2 * q.w * q.z
                * v.getX() - q.z * q.z * v.getY() + q.w * q.w * v.getY() - 2 * q.x * q.w * v.getZ() - q.x * q.x
                * v.getY();   
        double tempZ = 2 * q.x * q.z * v.getX() + 2 * q.y * q.z * v.getY() + q.z * q.z * v.getZ() - 2 * q.w * q.y * v.getX()
                - q.y * q.y * v.getZ() + 2 * q.w * q.x * v.getY() - q.x * q.x * v.getZ() + q.w * q.w * v.getZ();
        return new Vector3d(tempX, tempY, tempZ);
    }
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.