|
A utility class to find / test for intersections between geometric shapes.
In this static class, function names always have the two basic shapes ordered using the following order: - Line (straight line; infinite)
- Ray (starts at a point, extends to infinity)
- Segment (starts and ends on finite points)
- Circle
- Arc
- Rectangle (axis-aligned, ordered coords of each edge are known)
- BoundingBox (axis-aligned, ordered coords of each edge are known)
Hence it's always LineWithCircle, never CircleWithLine.
Many functions return one or multiple “lambda” values. These indicate how far along a line a point of intersection
is from its start point, relative to its end point: - A negative value indicates a position “before” the start point; 0 is the start point; 0.5 is the midpoint; 1
is the endpoint; and a value greater than 1 indicates a position “beyond” the end point.
- If no point of intersection exists, a lambda value of
double.NaN is returned. - If only one point of intersection is found by a function that returns two lambdas, it is always the first
lambda that identifies the point of intersection while the second is set to
double.NaN.
In cases where multiple points of intersections are possible, such as between a line and a circle, those overloads
that return only one point always return the one that is closer to the line’s start point. |