Package jinngine.math

Examples of jinngine.math.Vector3.sub()


        // check the next vertex from poly2
        if (poly2iter.hasNext()) {
          p2 = poly2iter.next();
         
          // distance less that epsilon
          if (p2.sub(p1).norm() >= epsilon)
            return false;
        } else {
          // no more vertices
          return true;
        }   
View Full Code Here


        } else {
          // no more vertices
          return true;
        }   
      } else {
        if (p2.sub(p1).norm() < epsilon) {
          traversalStarted = true;
        }
      }
    }
View Full Code Here

      final Vector3[] row0 = matrix[perm[0]];
      final Vector3[] row1 = matrix[perm[1]];
      final Vector3 y1 = row0[0];
      final Vector3 y2 = row1[0];

      final double d12_1 = y2.sub(y1).dot(y2);
      final double d12_2 = y1.sub(y2).dot(y1);
     
      //y1 (no permutation needed)
      if ( d12_2 <= 0 ) {                  lambda[perm[0]] = 1;  state.simplexSize = 1; return false;}
      //y2 ( (2,1)
View Full Code Here

      final double d23_3 = y2.sub(y3).dot(y2); //d23_3 = Math.abs(d23_3)<epsilon?0:d23_3;
      if ( d12_1 <= 0 && d23_3 <=0 ) //{Vector3.set(v,y2); return new Vector3[] {y2}; }
      { swap(1,0,perm); lambda[perm[0]]=1; state.simplexSize=1; return true; }
       
      //y3 (3,1)
      final double d13_1 = y3.sub(y1).dot(y3); //d13_1 = Math.abs(d13_1)<epsilon?0:d13_1;
      final double d23_2 = y3.sub(y2).dot(y3); //d23_2 = Math.abs(d23_2)<epsilon?0:d23_2;
      if ( d23_2 <= 0 && d13_1 <=0 ) //{Vector3.set(v,y3); return new Vector3[] {y3}; }
      { swap(2,0,perm); lambda[perm[0]]=1; state.simplexSize=1; return true; }
     
      final double d23 = d23_2 + d23_3;
View Full Code Here

      if ( d12_1 <= 0 && d23_3 <=0 ) //{Vector3.set(v,y2); return new Vector3[] {y2}; }
      { swap(1,0,perm); lambda[perm[0]]=1; state.simplexSize=1; return true; }
       
      //y3 (3,1)
      final double d13_1 = y3.sub(y1).dot(y3); //d13_1 = Math.abs(d13_1)<epsilon?0:d13_1;
      final double d23_2 = y3.sub(y2).dot(y3); //d23_2 = Math.abs(d23_2)<epsilon?0:d23_2;
      if ( d23_2 <= 0 && d13_1 <=0 ) //{Vector3.set(v,y3); return new Vector3[] {y3}; }
      { swap(2,0,perm); lambda[perm[0]]=1; state.simplexSize=1; return true; }
     
      final double d23 = d23_2 + d23_3;
      final double d13 = d13_1 + d13_3;
View Full Code Here

      final double d34_4 = y3.sub(y4).dot(y3); //d34_4= Math.abs(d34_4)<epsilon?0:d34_4;
      if ( d23_2 <= 0 && d13_1 <=0 && d34_4 <=0 ) //{Vector3.set(v, y3); return new Vector3[] {y3}; }
      { swap(2,0,perm); lambda[perm[0]] = 1; state.simplexSize=1; return true; }

      //y4 (4,1)
      final double d14_1 = y4.sub(y1).dot(y4); //d14_1= Math.abs(d14_1)<epsilon?0:d14_1;
      final double d24_2 = y4.sub(y2).dot(y4); //d24_2= Math.abs(d24_2)<epsilon?0:d24_2;
      final double d34_3 = y4.sub(y3).dot(y4); //d34_3= Math.abs(d34_3)<epsilon?0:d34_3;
      if ( d14_1 <= 0 && d24_2 <=0 && d34_3 <=0 ) //{Vector3.set(v, y4); return new Vector3[] {y4}; }
      { swap(3,0,perm); lambda[perm[0]] = 1; state.simplexSize=1; return true; }
View Full Code Here

      if ( d23_2 <= 0 && d13_1 <=0 && d34_4 <=0 ) //{Vector3.set(v, y3); return new Vector3[] {y3}; }
      { swap(2,0,perm); lambda[perm[0]] = 1; state.simplexSize=1; return true; }

      //y4 (4,1)
      final double d14_1 = y4.sub(y1).dot(y4); //d14_1= Math.abs(d14_1)<epsilon?0:d14_1;
      final double d24_2 = y4.sub(y2).dot(y4); //d24_2= Math.abs(d24_2)<epsilon?0:d24_2;
      final double d34_3 = y4.sub(y3).dot(y4); //d34_3= Math.abs(d34_3)<epsilon?0:d34_3;
      if ( d14_1 <= 0 && d24_2 <=0 && d34_3 <=0 ) //{Vector3.set(v, y4); return new Vector3[] {y4}; }
      { swap(3,0,perm); lambda[perm[0]] = 1; state.simplexSize=1; return true; }

      final double d12 = d12_1 + d12_2;
View Full Code Here

      { swap(2,0,perm); lambda[perm[0]] = 1; state.simplexSize=1; return true; }

      //y4 (4,1)
      final double d14_1 = y4.sub(y1).dot(y4); //d14_1= Math.abs(d14_1)<epsilon?0:d14_1;
      final double d24_2 = y4.sub(y2).dot(y4); //d24_2= Math.abs(d24_2)<epsilon?0:d24_2;
      final double d34_3 = y4.sub(y3).dot(y4); //d34_3= Math.abs(d34_3)<epsilon?0:d34_3;
      if ( d14_1 <= 0 && d24_2 <=0 && d34_3 <=0 ) //{Vector3.set(v, y4); return new Vector3[] {y4}; }
      { swap(3,0,perm); lambda[perm[0]] = 1; state.simplexSize=1; return true; }

      final double d12 = d12_1 + d12_2;
      final double d13 = d13_1 + d13_3;
View Full Code Here

   
    Matrix4.multiply(T,near,p1);
    Matrix4.multiply(T,far,p2);
   
    p.assign(p1);
    d.assign(p2.sub(p1).normalize());
  }
 
  /**
   * This is where the "magic" is done:
   *
 
View Full Code Here

    Vector3 point1 = p1.add( p2.sub(p1).multiply(result.x));
    Vector3 point2 = p3.add( p4.sub(p3).multiply(result.y));
   
    // we expect the intersection point to be (0.5,0.5) for both lines   
    assertTrue( point1.sub(new Vector3(0.5,0.5,0)).xynorm() < epsilon );
    assertTrue( point2.sub(new Vector3(0.5,0.5,0)).xynorm() < epsilon );
  }


  public void testIsInHalfPlane() {
    // test for the half-plane test. The O'Rourke algorithm
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.