Returns the point on line defined by startPoint and endPoint that is nearest to another point p.
dropPointOnLine ( p As Point, _ startPoint As Point, _ endPoint As Point, _ Optional useSegment? As Boolean = False ) As Point
Argument | Type | Description |
---|---|---|
p | Point | The point to drop. |
startPoint | Point | The start point of the line. |
endPoint | Point | The endpoint of the line. |
useSegment? | Boolean | Optional; when True the point is dropped on the line segment defined by startPoint and endPoint, even if the resulting point is beyond the start or end point ; default is False . |
Intent >dropPointOnLine(point(1,1,1), point(2,0,0), point(3,0,0)) --> Point_(1.0, 0.0, 0.0, WorldFrame())The example shows a point at 1,1,1 being dropped on a line aligned with the x axis.
Intent >dropPointOnLine(point(1,1,1), point(2,0,0), point(3,0,0), useSegment? := True) --> Point_(2.0, 0.0, 0.0, WorldFrame())In this example, the point at 1,1,1 is dropped to the same line segment as in the previous example. Because useSegment? is True and the drop point is beyond the end of the line segment, the point is 'snapped' to the nearest end of the segment.