Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Static class: RT.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 (straight 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"]Arc[Unrecognized tag: "item"]Rectangle (axis-aligned, ordered coords of each edge are known)[Unrecognized tag: "item"]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.

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".
ValueTuple<PointD?, double, PointD?, double> Finds the points of intersection between a line and a circle. (see also remarks)
void
LineWithCircle(ref EdgeD line, ref CircleD circle, out double lambda1, out double lambda2)
ValueTuple<PointD?, double, double>
LineWithLine(EdgeD line1, EdgeD line2)
Finds the point of intersection between two lines. (see also remarks)
void
LineWithLine(ref EdgeD line1, ref EdgeD line2, out double line1Lambda, out double line2Lambda)
PolygonDReturns a polygon formed by intersecting an arbitrary polygon with a convex polygon.
ValueTuple<PointD?, double, PointD?, double> Finds the points of intersection between a ray and an arc. (see also remarks)
void
RayWithArc(ref EdgeD ray, ref ArcD arc, out double lambda1, out double lambda2)
bool Checks for intersections between a ray and a bounding box. Returns true if there is at least one intersection.
ValueTuple<PointD?, double, PointD?, double> Finds the points of intersection between a ray and a circle. (see also remarks)
void
RayWithCircle(ref EdgeD ray, ref CircleD circle, out double lambda1, out double lambda2)
ValueTuple<PointD?, double, PointD?, double> Finds the points of intersection between a ray and a rectangle. (see also remarks)
void
RayWithRectangle(ref EdgeD ray, ref RectangleD rect, out double lambda1, out double lambda2)
ValueTuple<PointD?, double, double>
RayWithSegment(EdgeD ray, EdgeD segment)
Finds the point of intersection of a ray with a segment. (see also remarks)
void
RayWithSegment(ref EdgeD ray, ref EdgeD segment, out double rayL, out double segmentL)
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)