gnu.gleem
Class RayTriangleIntersection

java.lang.Object
  |
  +--gnu.gleem.RayTriangleIntersection

public class RayTriangleIntersection
extends java.lang.Object

Implements ray casting against a 3D triangle.


Field Summary
static int ERROR
           
static int INTERSECTION
           
static int NO_INTERSECTION
           
 
Constructor Summary
RayTriangleIntersection()
           
 
Method Summary
static int intersectRayWithTriangle(Vec3f rayOrigin, Vec3f rayDirection, Vec3f v0, Vec3f v1, Vec3f v2, IntersectionPoint intersectionPoint)
          Cast a ray starting at rayOrigin with rayDirection into the triangle defined by vertices v0, v1, and v2.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR

public static final int ERROR
See Also:
Constant Field Values

NO_INTERSECTION

public static final int NO_INTERSECTION
See Also:
Constant Field Values

INTERSECTION

public static final int INTERSECTION
See Also:
Constant Field Values
Constructor Detail

RayTriangleIntersection

public RayTriangleIntersection()
Method Detail

intersectRayWithTriangle

public static int intersectRayWithTriangle(Vec3f rayOrigin,
                                           Vec3f rayDirection,
                                           Vec3f v0,
                                           Vec3f v1,
                                           Vec3f v2,
                                           IntersectionPoint intersectionPoint)
Cast a ray starting at rayOrigin with rayDirection into the triangle defined by vertices v0, v1, and v2. If intersection occurred returns INTERSECTION and sets intersectionPoint appropriately, including t parameter (scale factor for rayDirection to reach intersection plane starting from rayOrigin). Returns NO_INTERSECTION if no intersection, or ERROR if triangle was degenerate or line was parallel to plane of triangle.