The Ray To Line Intersection node determines the point at which a ray defined by an origin and direction intersects a line segment defined by two points.
Inputs
Origin (float2)
Origin of the ray.
Direction (float2)
Direction of the ray.
LinePoint0 (float2)
First point of the line segment.
LinePoint1 (float2)
Second point of the line segment.
Outputs
Intersection (float2)
The point at which the defined ray intersects with the line segment defined by LinePoint0
and LinePoint1
. If the ray does not intersect, the value will be [0; 0]
.
Intersects (bool)
True
if the ray intersects with Rectangle
, False
otherwise. If the defined ray has both the same slope and lies on the line segment, it will not count as intersection. If the ray starts on the line segment and has a distinct slope from the line segment, it will count as intersection, and the intersection point will be Origin
.
Examples
-
An example of the Ray To Line Intersection node, along with a graphical visual of the intersection.
-
Edge cases of the node. From top left to bottom right:
Origin
lying on the line segment, but the slope differs; The ray lying on the line segment; and the ray intersecting outside of the two defined points.