Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Static class: RT.Util.Geometry.Intersect

Summary

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:

[Unrecognized tag: "list"][Unrecognized tag: "item"]Line (infinite)[Unrecognized tag: "item"]Ray (starts at a point, extends to infinity)[Unrecognized tag: "item"]Segment (starts and ends on finite points)[Unrecognized tag: "item"]Circle[Unrecognized tag: "item"]BoundingBox (axis-aligned, ordered coords of each edge are known)

Hence it's always LineWithCircle, never CircleWithLine.

Static methods

bool Checks for intersections between the two bounding boxes specified by the coordinates. Returns true if there is at least one intersection.
bool
BoundingBoxWithBoundingBox(double fx1, double fy1, double tx1, double ty1, double fx2, double fy2, double tx2, double ty2)
Checks for intersections between the two bounding boxes specified by the coordinates. Returns true if there is at least one intersection. Coordinates ending with "1" belong to the first box, "2" to the second one. Coordinates starting with "f" MUST be less than or equal to ones starting with "t".
PointD

Finds the point of intersection between two lines, specified by two points each.

If the lines coincide or are parallel, returns (NaN,NaN).

void
LineWithCircle(ref EdgeD line, ref CircleD circle, out double lambda1, out double lambda2)
Finds the points of intersection between a line and a circle. The results are two lambdas along the line, one for each point, or NaN if there is no intersection.
void
LineWithCircle(EdgeD line, CircleD circle, out double lambda1, out double lambda2)
PointD
LineWithLine(EdgeD line1, EdgeD line2)
Finds the point of intersection of two lines. If the lines don't intersect, the resulting point coordinates are NaN.
void
LineWithLine(ref EdgeD line1, ref EdgeD line2, out double line1Lambda, out double line2Lambda)
Finds the point of intersection of two lines. The result is in terms of lambda along each of the lines. Point of intersection is defined as "line.Start + lambda * line", for each line. If the lines don't intersect, the lambdas are set to NaN.
ValueTuple<PointD, double, double>
PolygonDReturns a polygon formed by intersecting an arbitrary polygon with a convex polygon.
void
RayWithArc(ref EdgeD ray, ref ArcD arc, out double lambda1, out double lambda2)
Finds the points of intersection between a ray and an arc. The resulting lambdas along the ray are sorted in ascending order, so the "first" intersection is always in lambda1 (if any). Lambda may be NaN if there is no intersection (or no "second" intersection).
bool Checks for intersections between a ray and a bounding box. Returns true if there is at least one intersection.
void
RayWithCircle(ref EdgeD ray, ref CircleD circle, out double lambda1, out double lambda2)
Finds the points of intersection between a ray and a circle. The resulting lambdas along the ray are sorted in ascending order, so the "first" intersection is always in lambda1 (if any). Lambda may be NaN if there is no intersection (or no "second" intersection).
void
RayWithRectangle(ref EdgeD ray, ref RectangleD rect, out double lambda1, out double lambda2)
Finds intersections between a ray and a rectangle. Returns the lambdas of intersections, if any, or NaN otherwise. Guarantees that lambda1 < lambda2, and if only one of them is NaN then it's lambda2. Lambda is such that ray.Start + lambda * (ray.End - ray.Start) gives the point of intersection.
void
RayWithSegment(ref EdgeD ray, ref EdgeD segment, out double rayL, out double segmentL)
Calculates the intersection of a ray with a segment. Returns the result as the lambdas of the intersection point along the ray and the segment. If there is no intersection returns double.NaN in both lambdas.
bool
SegmentWithSegment(double f1x, double f1y, double t1x, double t1y, double f2x, double f2y, double t2x, double t2y)
If the two specified line segments touch anywhere, returns true. Otherwise returns false. See Remarks. (see also remarks)