Package jinngine.collision

Examples of jinngine.collision.GJK$State


 
  /**
   * Two spheres excactly overlapping each other
   */
  public void testOverlapSphere1() {
    GJK gjk = new GJK();
   
    //set up two spheres, occupying the exact same space
    Sphere s1 = new Sphere(1);
    Body b1 = new Body("default", s1);
    b1.setPosition(new Vector3(0,0,0));
    Sphere s2 = new Sphere(1);
    Body b2 = new Body("default", s2);
    b2.setPosition(new Vector3(0,0,0));
   
    //closest point vectors
    Vector3 p1 = new Vector3();
    Vector3 p2 = new Vector3();
       
    gjk.run(s1,s2,p1,p2,Double.POSITIVE_INFINITY, epsilon, 31);
   
    // we expect closest points to be the same
    assertTrue( p1.sub(p2).norm() < epsilon );
  }
View Full Code Here


      Vector3 p1 = new Vector3();
      Vector3 p2 = new Vector3();

      // create a new gjk every time, to avoid the frame coherence
      // heuristic inside GJK
      GJK gjk = new GJK();
     
      // when the distance between objects becomes close to zero,
      // the gjk algorithm gegenerates and produces less acurate results.
      // therefore we use more iterations here
      gjk.run(s1,s2,p1,p2,Double.POSITIVE_INFINITY, epsilon, 2256);
     
      // we want the expected distance
      assertTrue( Math.abs( p1.sub(p2).norm() - expected ) < epsilon );
    }
  }
View Full Code Here

TOP

Related Classes of jinngine.collision.GJK$State

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.