# PointToLine

Computes the minimum distance from a point to a line.

Example

In this example, the PointToLine function Functions are tools that are available in Spreadsheet for processing and analyzing acquisitions or other results. You can add functions to your Spreadsheet job to create tool chains and produce results for specific applications. is measuring the distance between a point and a line. The point is the origin, and the angle is calculated based on its position relative to the line.

Inputs

The PointToLine function has the following syntax:

PointToLine(Image, X, Y, X1, Y1, X0, Y0, X1, Y1, Show)

See the table for a description of the available parameters.

Parameter | Description
Image | This argument must reference a spreadsheet cell that contains a valid Image data structure. By default, the cell referenced is cell A0, containing the AcquireImage function.
Point | Specifies the coordinates of the point, which are used as the origin.
X | The X coordinate of the point.
Y | The Y coordinate of the point.
Line | Specifies the coordinates of the line.
X 0 | The X coordinate of the first endpoint of the line.
Y 0 | The Y coordinate of the first endpoint of the line.
X 1 | The X coordinate of the second endpoint of the line.
Y 1 | The Y coordinate of the second endpoint of the line.
Show | Specifies the display mode for the graphical overlays of the function on top of the image.
0 = hide all | All graphics are hidden, except when the cell containing the function is highlighted in the spreadsheet.
1 = result graphics only | A line segment showing the minimum distance between the point and the input line is displayed at all times.
2 = input and result graphics | The point, the input line, and the line segment between them are displayed at all times.

Outputs

Returns | A Dist data structure containing the directed distance between the point and the nearest point on the line.
Results | When the function is initially inserted into a cell, a result table is created in the spreadsheet.

Vision Data Access functions

The following Dist Vision Data Access functions are automatically inserted into the spreadsheet to create the result table:

Label | Function | Description
--- | --- | ---
X0 | GetX(Dist, 0) | The X coordinate of the point.
Y0 | GetY(Dist, 0) | The Y coordinate of the point.
X1 | GetX(Dist, 1) | The X coordinate of the nearest point on the line.
Y1 | GetY(Dist, 1) | The Y coordinate of the nearest point on the line.
Angle | GetAngle(Dist) | The point-to-line angle.
Distance | GetDistance(Dist) | The point-to-line distance.