Point Distance From Line 2D

A function that returns a point's distance from a line defined by two points

This script computes the distance of a point from a line defined by two points.

Function:
PointToLine2D(P, L0, L1):
– P is the point (node or a user-defined object with *.x and *.y properties) that is being tested.
– L0 beginning point of the line.
– L1 end point of the line.

The function returns the point’s distance from the line.

In this example, the user has to select 3 nodes from the model. The first two nodes (L0, L1) define the line and the third node (P) is that measured from the defined line.