create page |
ooopsie |
||
(One intermediate revision by the same user not shown) | |||
Line 38: | Line 38: | ||
=== Intersects ([[Type:bool|bool]]) === | === Intersects ([[Type:bool|bool]]) === | ||
<code>True</code> if the ray intersects with | <code>True</code> if the ray intersects with the line segment, <code>False</code> otherwise. If the defined ray has both the same slope and lies on the line segment, it will <em>not</em> 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 <code>Origin</code>. | ||
== Examples == | == Examples == | ||
Line 45: | Line 45: | ||
File:ProtoFlux Example Ray To Line Intersection Edge Cases.webp|Edge cases of the node. From top left to bottom right: <code>Origin</code> 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. | File:ProtoFlux Example Ray To Line Intersection Edge Cases.webp|Edge cases of the node. From top left to bottom right: <code>Origin</code> 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. | ||
</gallery> | </gallery> | ||
== See Also == | |||
* [[ProtoFlux:Ray To Line Intersection Distance]] | |||
[[Category:ProtoFlux:Math:Geometry2D]] | [[Category:ProtoFlux:Math:Geometry2D]] |
Latest revision as of 00:32, 3 July 2024
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 the line segment, 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.