PointOnSegmentNearestToPoint( SegmentA, SegmentB, P )


Module: Math

Summary:

Given a line segment and a point P, this returns the point on the segment that is closest to P.



Example:

nearestPoint = PointOnSegmentNearestToPoint( A, B, P );



Required Args:

  • 1 : <SegmentA> One endpoint of the line segment
  • 2 : <SegmentB> Other endpoint of the line segment
  • 3 : <P> The point


Notes:

 This function will return A or B if P is beyond these two points.