Method ClosestPointOnSegment
ClosestPointOnSegment(Vector3, Vector3, Vector3)
Get the closest point on a line segment.
Declaration
public static float ClosestPointOnSegment(this Vector3 p, Vector3 s0, Vector3 s1)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | p | A point in space |
Vector3 | s0 | Start of line segment |
Vector3 | s1 | End of line segment |
Returns
Type | Description |
---|---|
float | The interpolation parameter representing the point on the segment, with 0==s0, and 1==s1 |
ClosestPointOnSegment(Vector2, Vector2, Vector2)
Get the closest point on a line segment.
Declaration
public static float ClosestPointOnSegment(this Vector2 p, Vector2 s0, Vector2 s1)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | p | A point in space |
Vector2 | s0 | Start of line segment |
Vector2 | s1 | End of line segment |
Returns
Type | Description |
---|---|
float | The interpolation parameter representing the point on the segment, with 0==s0, and 1==s1 |