Package jinngine.collision

Examples of jinngine.collision.RayCast.run()


        // if geometry is usable
        if ( gi instanceof SupportMap3) {

          RayCast raycast = new RayCast();
          Vector3 pb = new Vector3(), pc = new Vector3();
          double t = raycast.run((SupportMap3)gi, null, point, direction, pb, pc, 0, 0.05, 1e-7, true);

//          write out t for debugging
//          System.out.println("t="+t);
         
          if (t<parameter) {
View Full Code Here


    // the centre of the sphere.
    Vector3 point = new Vector3(-4, 6, 9);
    Vector3 direction = point.multiply(-1);
   
    // do the raycast
    double lambda = raycast.run(s1, null, point, direction, new Vector3(), new Vector3(), 0, envelope, epsilon, false );
   
    // we know the exact intersection point
    Vector3 expected = point.normalize();
   
    // calculate the deviation of the returned point and the reference point
View Full Code Here

    // the centre of the sphere.
    Vector3 point = new Vector3(-4, 6, 9);
    Vector3 direction = b1.getPosition().sub(point);
   
    // do the raycast
    double lambda = raycast.run(s1, null, point, direction, new Vector3(), new Vector3(), 0, envelope, epsilon, false );
   
    // we know the exact intersection point ( go from the centre of the sphere
    // to the boundary along the oposite ray direction )
    Vector3 expected = b1.getPosition().sub(direction.normalize());
   
View Full Code Here

    Vector3 direction = new Vector3(-1,0,0);
   
    System.out.println("*********************************************************************");
   
    // do the raycast
    double lambda = raycast.run(s1, null, point, direction, new Vector3(), new Vector3(), 0, envelope, epsilon, false );
   
    // calculate the  point
    Vector3 p = point.add(direction.multiply(lambda));
   
    System.out.println("p norm="+p.norm());
View Full Code Here

   
    // move the sphere a bit downwards
    b1.setPosition(0,-envelope-2*epsilon, 0);
   
    // do the raycast
    lambda = raycast.run(s1, null, point, direction, new Vector3(), new Vector3(), 0, envelope, epsilon, false );
   
    System.out.println("returned lambda="+lambda);
   
    assertTrue( lambda == Double.POSITIVE_INFINITY);
   
View Full Code Here

    // select a point (5,1,0) and the raydirection (-1,0,0)
    Vector3 point = new Vector3(0, 5, 0);
    Vector3 direction = new Vector3(0,-1,0);
   
    // do the raycast
    double lambda = raycast.run(box, null, point, direction, new Vector3(), new Vector3(), 0, envelope, epsilon, false );
   
    // calculate the  point
    Vector3 p = point.add(direction.multiply(lambda));
   
    // expected point
View Full Code Here

    // select a point (5,1,0) and the raydirection (-1,0,0)
    Vector3 point = new Vector3(2, 5, 9);
    Vector3 direction = new Vector3(0.5,0.5,0.5).sub(point);
   
    // do the raycast
    double lambda = raycast.run(box, null, point, direction, new Vector3(), new Vector3(), 0, envelope, epsilon, false );
   
    // calculate the  point
    Vector3 p = point.add(direction.multiply(lambda));
   
    // expected point
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.