DOTS Geometry
 
Loading...
Searching...
No Matches
ShapeIntersection Class Reference

Static Public Member Functions

static bool LineIntersection (Line2D l0, Line2D l1, out float2 intersection, float epsilon=10e-5f)
 Intersects two lines in 2D Space.
 
static bool LineIntersection (Line3D l0, Line3D l1, out float3 intersection, float mergeDistance=10e-5f, float epsilon=10e-5f)
 Intersects two lines in 3D Space.
 
static bool LineLineSegmentIntersection (Line2D l0, LineSegment2D l1, out float2 intersection, float epsilon=10e-5f)
 Intersects a 2D line with a 2D line segment.
 
static int LineRectangleIntersections (Line2D line, Rect rect, out float2 intersection0, out float2 intersection1, float epsilon=10e-5f)
 Intersects a line with a rectangle. There are 0, 1 or 2 possible points the line can cross. The number of intersections is returned. If the number is 1, only the first intersection point returned is valid (the second one will contain invalid data).
 
static int LineSegmentCircleIntersections (LineSegment2D line, float2 center, float radiusSq, out float2 intersection0, out float2 intersection1, out bool inside)
 Intersects a line segment with a circle. There are 0, 1 or 2 possible points they cross. The number of intersections is returned. If the number is 1, only the first intersection point returned is valid (the second one will contain invalid data).
 
static int LineSegmentCuboidIntersections (LineSegment3D line, Bounds bounds, out float3 intersection0, out float3 intersection1, out bool inside, float epsilon=10e-7f)
 Returns the intersections between a line segment and a box / cuboid. The number of intersections may be 0, 1 or 2. If the line segment is completely contained inside the box, inside is set to true.
 
static bool LineSegmentIntersection (LineSegment2D s0, LineSegment2D s1, out float2 intersection)
 Intersects two line segments with each other. If they are parallel, false is returned and the intersection is invalid (NaN).
 
static int LineSegmentRectangleIntersections (LineSegment2D line, Rect rect, out float2 intersection0, out float2 intersection1, out bool inside, float epsilon=10e-5f)
 Intersects a line segment with a rectangle. There are 0, 1 or 2 possible points the line can cross. The number of intersections is returned. If the number is 1, only the first intersection point returned is valid (the second one will contain invalid data).
 
static int LineSegmentSphereIntersections (LineSegment3D line, float3 center, float radiusSq, out float3 intersection0, out float3 intersection1, out bool inside)
 Intersects a line segment with a sphere. There are 0, 1 or 2 possible points they cross. The number of intersections is returned. If the number of intersections is 1, only the first intersection point returned is valid (the second one will contain invalid data).
 
static bool LineSegmentTriangleIntersection (LineSegment3D ls, NativeTriangle3D triangle, out float3 intersection, float epsilon=10e-7f)
 Intersects a line segment with a triangle. If they do not intersect, false is returned. Otherwise, true is returned and the out parameter intersection holds the position where.
 
static FixedList128Bytes< float3 > PlaneCuboidIntersections (Plane p0, Bounds bounds, float epsilon=10e-7f)
 Intersects a Cuboid with a 3D Plane.
 
static bool PlaneIntersection (Plane p0, Plane p1, out Line3D intersectionLine, float mergeDistance=10e-5f, float epsilon=10e-5f)
 Intersects two 3D Planes. The result is a 3D Line.
 
static bool PlaneLineIntersection (Plane p0, Line3D l0, out float3 intersection, float epsilon=10e-5f)
 Intersects a 3D Plane with a 3D Line, resulting in an intersection point.
 
static bool PlaneLineSegmentIntersection (Plane p0, LineSegment3D l0, out float3 intersection, float epsilon=10e-5f)
 Calculates the intersection between a line segment and a plane. False is returned if they do not intersect.
 

Member Function Documentation

◆ LineIntersection() [1/2]

static bool LineIntersection ( Line2D l0,
Line2D l1,
out float2 intersection,
float epsilon = 10e-5f )
static

Intersects two lines in 2D Space.

Parameters
l0
l1
intersectionThe point of intersection of the two lines. It is set to NaN if the lines are parallel
epsilon
Returns
True, if the lines are not parallel, and false otherwise

◆ LineIntersection() [2/2]

static bool LineIntersection ( Line3D l0,
Line3D l1,
out float3 intersection,
float mergeDistance = 10e-5f,
float epsilon = 10e-5f )
static

Intersects two lines in 3D Space.

Parameters
l0
l1
intersectionThe point of intersection of the two lines (or a point at most mergeDistance away from both lines)
mergeDistanceThe maximum distance the lines can be apart to be considered intersecting
epsilon
Returns

◆ LineLineSegmentIntersection()

static bool LineLineSegmentIntersection ( Line2D l0,
LineSegment2D l1,
out float2 intersection,
float epsilon = 10e-5f )
static

Intersects a 2D line with a 2D line segment.

Parameters
l0
l1
intersection
epsilon
Returns
True, if the line and line segment intersect each other, and false otherwise

◆ LineRectangleIntersections()

static int LineRectangleIntersections ( Line2D line,
Rect rect,
out float2 intersection0,
out float2 intersection1,
float epsilon = 10e-5f )
static

Intersects a line with a rectangle. There are 0, 1 or 2 possible points the line can cross. The number of intersections is returned. If the number is 1, only the first intersection point returned is valid (the second one will contain invalid data).

Parameters
line
rect
intersection0
intersection1
epsilon
Returns

◆ LineSegmentCircleIntersections()

static int LineSegmentCircleIntersections ( LineSegment2D line,
float2 center,
float radiusSq,
out float2 intersection0,
out float2 intersection1,
out bool inside )
static

Intersects a line segment with a circle. There are 0, 1 or 2 possible points they cross. The number of intersections is returned. If the number is 1, only the first intersection point returned is valid (the second one will contain invalid data).

If the line segment is completely contained within the circle, inside is set to true.

GPU: GGGIntersection

Parameters
line
center
radiusSq
intersection0
intersection1
Returns

◆ LineSegmentCuboidIntersections()

static int LineSegmentCuboidIntersections ( LineSegment3D line,
Bounds bounds,
out float3 intersection0,
out float3 intersection1,
out bool inside,
float epsilon = 10e-7f )
static

Returns the intersections between a line segment and a box / cuboid. The number of intersections may be 0, 1 or 2. If the line segment is completely contained inside the box, inside is set to true.

GPU: GGGIntersection

Parameters
line
bounds
intersection0
intersection1
inside
epsilon
Returns

◆ LineSegmentIntersection()

static bool LineSegmentIntersection ( LineSegment2D s0,
LineSegment2D s1,
out float2 intersection )
static

Intersects two line segments with each other. If they are parallel, false is returned and the intersection is invalid (NaN).

GPU: GGGIntersecton

Parameters
s0
s1
intersection
Returns

◆ LineSegmentRectangleIntersections()

static int LineSegmentRectangleIntersections ( LineSegment2D line,
Rect rect,
out float2 intersection0,
out float2 intersection1,
out bool inside,
float epsilon = 10e-5f )
static

Intersects a line segment with a rectangle. There are 0, 1 or 2 possible points the line can cross. The number of intersections is returned. If the number is 1, only the first intersection point returned is valid (the second one will contain invalid data).

If the line segment is completely contained within the rectangle, inside is set to true.

GPU: GGGIntersection

Parameters
line

, flo

Parameters
rect
intersection0
intersection1
inside
Returns

◆ LineSegmentSphereIntersections()

static int LineSegmentSphereIntersections ( LineSegment3D line,
float3 center,
float radiusSq,
out float3 intersection0,
out float3 intersection1,
out bool inside )
static

Intersects a line segment with a sphere. There are 0, 1 or 2 possible points they cross. The number of intersections is returned. If the number of intersections is 1, only the first intersection point returned is valid (the second one will contain invalid data).

If the line segment is completely contained within the sphere, inside is set to true.

GPU: GGGIntersection

Parameters
line
center
radiusSq
intersection0
intersection1
Returns

◆ LineSegmentTriangleIntersection()

static bool LineSegmentTriangleIntersection ( LineSegment3D ls,
NativeTriangle3D triangle,
out float3 intersection,
float epsilon = 10e-7f )
static

Intersects a line segment with a triangle. If they do not intersect, false is returned. Otherwise, true is returned and the out parameter intersection holds the position where.

Parameters
ls
triangle
intersection
epsilon
Returns

◆ PlaneCuboidIntersections()

static FixedList128Bytes< float3 > PlaneCuboidIntersections ( Plane p0,
Bounds bounds,
float epsilon = 10e-7f )
static

Intersects a Cuboid with a 3D Plane.

Parameters
p0
bounds
epsilon
Returns
A list of intersection points that lie on the edges of the cuboid. If the plane and cuboid do not intersect, the list is empty

◆ PlaneIntersection()

static bool PlaneIntersection ( Plane p0,
Plane p1,
out Line3D intersectionLine,
float mergeDistance = 10e-5f,
float epsilon = 10e-5f )
static

Intersects two 3D Planes. The result is a 3D Line.

Parameters
p0
p1
intersectionLineThe line that is the intersection between the two planes. It is equal to Line3D.Invalid if the two planes are parallel
mergeDistance
epsilon
Returns
True if the two planes are intersecting, and false if they are parallel to each other

◆ PlaneLineIntersection()

static bool PlaneLineIntersection ( Plane p0,
Line3D l0,
out float3 intersection,
float epsilon = 10e-5f )
static

Intersects a 3D Plane with a 3D Line, resulting in an intersection point.

Parameters
p0
l0
intersectionThe intersection point of the plane and the line. It is equal to NaN if the line is parallel to the plane
epsilon
Returns
True if the plane and the line are intersecting, and false if they are parallel to each other

◆ PlaneLineSegmentIntersection()

static bool PlaneLineSegmentIntersection ( Plane p0,
LineSegment3D l0,
out float3 intersection,
float epsilon = 10e-5f )
static

Calculates the intersection between a line segment and a plane. False is returned if they do not intersect.

GPU: GGGIntersection

Parameters
p0
l0
intersection
epsilon
Returns