-
-
Notifications
You must be signed in to change notification settings - Fork 18
line_in_line
Vašek edited this page Feb 10, 2019
·
3 revisions
Returns the point where the two given lines intersect
line_in_line(p1, p2, p3, p4, tolerance)
Argument | Description |
---|---|
Vector2 p1 |
The first point of the first line |
Vector2 p2 |
The other point of the first line |
Vector2 p3 |
The first point of the other line |
Vector2 p4 |
The other point of the other line |
double tolerance |
Tolerance of the positions difference - default = 0.001, not required |
Returns: Vector2?
If the two given lines intersect, this function returns the intersection point. Otherwise, this function returns null.
Vector2? pos = line_in_line(new Vector2(0, 0), new Vector2(10, 10), new Vector2(0, 10), new Vector2(10, 0));
if (pos.HasValue)
{
Vector2 point = pos.Value;
}
This function will set point
to 5, 5.
Back to Raycasting