Class IntrRay2Segment2f
- java.lang.Object
-
- WildMagic.LibFoundation.Intersection.IntrRay2Segment2f
-
- All Implemented Interfaces:
java.io.Serializable
public class IntrRay2Segment2f extends java.lang.Object implements java.io.Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description IntrRay2Segment2f()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static int
Find(Vector2f kP0, Vector2f kD0, Vector2f kP1, Vector2f kD1, Vector2f kDiff, float[] afT)
Intersection is a solution to P0+s*D0 = P1+t*D1.static int
FindIntersection(Ray2f kRay, Segment2f kSegment, float[] afT)
The return quantity is 0 if the objects do not intersect, or is 1 or 2 if they do intersect.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
FindIntersection
public static int FindIntersection(Ray2f kRay, Segment2f kSegment, float[] afT)
The return quantity is 0 if the objects do not intersect, or is 1 or 2 if they do intersect. If 2, then the returned values are the end points of an interval of intersection. If an intersection occurs, the returned values are the parameter values for the point(s) of intersection with respect to the first object parameterized by P+t*D (t in [-inf,+inf] for line, t in [0,+inf] for ray, t in [0,1] for segment). The t parameter for the points of intersection are returned in the afT array which must have length 2.- Parameters:
kRay
- DOCUMENT ME!kSegment
- DOCUMENT ME!afT
- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
Find
private static int Find(Vector2f kP0, Vector2f kD0, Vector2f kP1, Vector2f kD1, Vector2f kDiff, float[] afT)
Intersection is a solution to P0+s*D0 = P1+t*D1. Rewrite as s*D0 - t*D1 = P1 - P0, a 2x2 system of equations. If D0 = (x0,y0) and D1 = (x1,y1) and P1 - P0 = (c0,c1), then the system is x0*s - x1*t = c0 and y0*s - y1*t = c1. The error tests are relative to the size of the direction vectors, |Cross(D0,D1)| >= e*|D0|*|D1| rather than absolute tests |Cross(D0,D1)| >= e. The quantities P1-P0, |D0|^2, and |D1|^2 are returned for use by calling functions.- Parameters:
kP0
- DOCUMENT ME!kD0
- DOCUMENT ME!kP1
- DOCUMENT ME!kD1
- DOCUMENT ME!kDiff
- DOCUMENT ME!afT
- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
-