Package javax.vecmath

Examples of javax.vecmath.Vector3d.normalize()


            v1.sub(b, a);
            v2.sub(c, a);
            faceNormal.cross(v1, v2);
            if (faceNormal.length()==0) continue;
            faceNormal.normalize();

            // suppose the faces are nearly flat, with small deflection
            // check the scalar product is >0, so each face is the same orientation
            // otherwise, reverse the normal
            double scalara = normal[ja] * faceNormal.x + normal[ja+1] * faceNormal.y + normal[ja+2] * faceNormal.z;
 
View Full Code Here


        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

    private void thrust(){
        if(speed.length()>10){
            return;
        }
        Vector3d thrust = new Vector3d(speed);
        thrust.normalize();
        thrust.scale(0.1);
        speed.add(thrust);
    }
           
    private void gravity(){
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{
View Full Code Here

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

        double htScale = options_.getHeightScale();
        Vector3d xVec = new Vector3d(1.0, 0.0, htScale * xdelta);
        Vector3d yVec = new Vector3d(0.0, 1.0, htScale * ydelta);
        Vector3d surfaceNormal = new Vector3d();
        surfaceNormal.cross(xVec, yVec);
        surfaceNormal.normalize();

        return computeColor(c, surfaceNormal);
    }

    /**
 
View Full Code Here

    LOG.debug("S is " + S);

    // Normalise both these vectors
    // Equ. 5.3a
    R.normalize();
    S.normalize();


    // Now, the gradients

    Vector3d gradPhiI = new Vector3d();
View Full Code Here

    Rij.sub(Rj);
    Rkj.sub(Rj);

    // Normalise both vectors.
    Rij.normalize();
    Rkj.normalize();

    // Dot product; angle between two vectors
    return Math.toDegrees(Math.acos(Rij.dot(Rkj)));

  }
View Full Code Here

    double aligned = 0.999;
    /* Normalize both vectors */
    Vector3d r1 = v1;
    Vector3d r2 = v2;
    r1.normalize();
    r2.normalize();
    double sprod = r1.dot(r2);
    /* This takes care about the bug in vecmath method from java3d project */
    if (sprod > aligned) { // almost aligned
      r1.sub(r2);
      double diff = r1.length();
View Full Code Here

               forceOnPen.scale(-kpPenOnDesk.getDoubleValue());
               double maxPenForce = 5.0;
              
               if (forceOnPen.length() > maxPenForce)
               {
                  forceOnPen.normalize();
                  forceOnPen.scale(maxPenForce);
               }
               penExternalForcePoint.setForce(forceOnPen);
              
               if (getTime() > 10.0) harmonographPaperJPanel.addPoint(penProjectionInDeskFrame);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.