Package org.mt4j.util.math

Examples of org.mt4j.util.math.Vector3D.normalizeLocal()


    //Get direction vector from eye to camera
    Vector3D dirToCamVect = camPos.getSubtracted(viewCenterPos);
    //get the length of that vector
    float mag = dirToCamVect.length();
    //normalize the vector
    dirToCamVect.normalizeLocal();
    //scale the normalized vector with the original amount + the zoom amount
    dirToCamVect.scaleLocal(mag + amount);
   
    if (dirToCamVect.length() > zoomMinDistance){
      //Get the Vector to the camera from origin
View Full Code Here


          //Also checks if normals are attempted to be added that are equal to this faces normal
          //or normals that have already been added -> those are not added
         
//          /*
          Vector3D normalizedFaceNormal = this.normal.getCopy();
          normalizedFaceNormal.normalizeLocal();

          logger.debug("");
          logger.debug("Face " + index + " normal: " + this.normal + " Normalized: " + normalizedFaceNormal);
          logger.debug("P0:");

View Full Code Here

            MyFace neighborFaceP0 = smoothNeighborsP0.get(i);

            Vector3D nextSmoothNeighborNormal       = neighborFaceP0.normal;
            Vector3D nextSmoothNeighborNormalNormalized = nextSmoothNeighborNormal.getCopy();
            //TODO doch nochmal probieren mit vorher ausgerechneter normal? sonst performance loss!
            nextSmoothNeighborNormalNormalized.normalizeLocal();//neighborFaceP0.normalNormalized;
            boolean alreadyAddedSameNormalIn = false;
           
           
            //Dont add faces normals that are equal to this faces normals
            if (!useNormalsEqualToFace && nextSmoothNeighborNormalNormalized.equalsVectorWithTolerance(normalizedFaceNormal, ToolsMath.ZERO_TOLERANCE)){
View Full Code Here

            MyFace neighborFaceP1 = smoothNeighborsP1.get(i);

            Vector3D nextSmoothNeighborNormal       = neighborFaceP1.normal;
            Vector3D nextSmoothNeighborNormalNormalized = nextSmoothNeighborNormal.getCopy();
            //TODO doch nochmal probieren mit vorher ausgerechneter normal? sonst performance loss!
            nextSmoothNeighborNormalNormalized.normalizeLocal();//neighborFaceP1.normalNormalized;
            boolean alreadyAddedSameNormalIn = false;
           
            //Dont add faces normals that are equal to this faces normals
            if (!useNormalsEqualToFace && nextSmoothNeighborNormalNormalized.equalsVectorWithTolerance(normalizedFaceNormal, ToolsMath.ZERO_TOLERANCE)){
              alreadyAddedSameNormalIn = true;
View Full Code Here

            MyFace neighborFaceP2 = smoothNeighborsP2.get(i);

            Vector3D nextSmoothNeighborNormal       = neighborFaceP2.normal;
            Vector3D nextSmoothNeighborNormalNormalized = nextSmoothNeighborNormal.getCopy();
            //TODO doch nochmal probieren mit vorher ausgerechneter normal? sonst performance loss!
            nextSmoothNeighborNormalNormalized.normalizeLocal();//neighborFaceP2.normalNormalized;
            boolean alreadyAddedSameNormalIn = false;
           
           
            //Dont add faces normals that are equal to this faces normals
            if (!useNormalsEqualToFace && nextSmoothNeighborNormalNormalized.equalsVectorWithTolerance(normalizedFaceNormal, ToolsMath.ZERO_TOLERANCE)){
View Full Code Here

    Vertex v0 = getVerticesLocal()[0];
    Vertex v1 = getVerticesLocal()[1];

    if (v0.z == 0 && v1.z == 0){ //Only create bounding poly if the line is in the z=0 plane
      Vector3D dir = v1.getSubtracted(v0);
      dir.normalizeLocal();
      dir.scaleLocal(10);
      dir.rotateZ(PApplet.radians(90));
      Vector3D bv0 = new Vector3D(v0.getAdded(dir));
      Vector3D bv1 = new Vector3D(v0.getAdded(dir.getScaled(-1)));
      Vector3D bv2 = new Vector3D(v1.getAdded(dir.getScaled(-1)));
View Full Code Here

            allNeighborNormal.addLocal(neighbor.normal);
           
            logger.debug("Vertex index:" + this.getArrayIndex() + " calcing in neighbor normal of face: " + neighbor.index);
          }
          //Normalize in the end
          allNeighborNormal.normalizeLocal();
          allNeighborsNormal = allNeighborNormal;
          return allNeighborsNormal;
        }else{
          return allNeighborsNormal;
        }
View Full Code Here

   *
   * @return true, if point is in triangle.
   */
  public boolean containsPoint(Vector3D p) {
    Vector3D a = p.getSubtracted(v0);
    a.normalizeLocal();
    Vector3D b = p.getSubtracted(v1);
    b.normalizeLocal();
    Vector3D c = p.getSubtracted(v2);
    c.normalizeLocal();

View Full Code Here

   */
  public boolean containsPoint(Vector3D p) {
    Vector3D a = p.getSubtracted(v0);
    a.normalizeLocal();
    Vector3D b = p.getSubtracted(v1);
    b.normalizeLocal();
    Vector3D c = p.getSubtracted(v2);
    c.normalizeLocal();

    double total_angles = Math.acos(a.dot(b));
    total_angles += Math.acos(b.dot(c));
View Full Code Here

    Vector3D a = p.getSubtracted(v0);
    a.normalizeLocal();
    Vector3D b = p.getSubtracted(v1);
    b.normalizeLocal();
    Vector3D c = p.getSubtracted(v2);
    c.normalizeLocal();

    double total_angles = Math.acos(a.dot(b));
    total_angles += Math.acos(b.dot(c));
    total_angles += Math.acos(c.dot(a));
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.