PointOnSegmentNearestToPoint( SegmentA, SegmentB, P )

Module: Math


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


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


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