Check to find a point on a line in 2D

Function to check if a point is on a line in xy-plane

This script uses properties of vectors to determine whether a user-defined point is on a line in the xy-plane.

Function:
PointOnLine2D – this function checks whether a point is on the line or not.

Three objects must be input into the function. Example: PointOnLine2D(point, line_beginning, line_ending).

The function takes two types of inputs:
– Node objects.
– User defined objects with properties *.x and *.y.

PointOnLine2D returns “true” if the selected point is on the line.

In the example, the user is prompted to select two nodes in the model to determine the line. The third node will be the point to be checked.