# LineToLine

Computes the point and angle of the intersection between two lines. If the lines do not intersect, the distance between the lines is computed and returned instead.

Inputs

The LineToLine 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. has the following syntax:

LineToLine(Image, X0, Y0, 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.
Line 0 | Specifies the coordinates of the first line segment.
X 0 | The X coordinate of the first endpoint of the first line.
Y 0 | The Y coordinate of the first endpoint of the first line.
X 1 | The X coordinate of the second endpoint of the first line.
Y 1 | The Y coordinate of the second endpoint of the first line.
Line 1 | Specifies the coordinates of the second line segment.
X 0 | The X coordinate of the first endpoint of the second line.
Y 0 | The Y coordinate of the first endpoint of the second line.
X 1 | The X coordinate of the second endpoint of the second line.
Y 1 | The Y coordinate of the second endpoint of the second 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 two input lines is displayed at all times.
2 = input and result graphics | The input lines and the line segment between them are displayed at all times.

Outputs

Returns | If the two lines intersect, the function returns a Dist data structure containing the point of intersection, the angle between the directed lines segments, and a distance equal to 0. If the two lines do not intersect, the function returns a Dist data structure containing a point for each line, the distance between the lines, and the angle between the directed line segments.
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) | If intersecting, the X coordinate of the point of intersection. If not intersecting, the X coordinate of the first endpoint of Line 0.
Y0 | GetYl(Dist, 0) | If intersecting, the Y coordinate of the point of intersection. If not intersecting, the Y coordinate of the first endpoint of Line 0.
X1 | GetX(Dist, 1) | If intersecting, the X coordinate of the point of intersection. If not intersecting, the X coordinate of the point on Line 1 nearest the first endpoint of Line 0.
Y1 | GetY(Dist, 1) | If intersecting, the Y coordinate of the point of intersection. If not intersecting, the Y coordinate of the point on Line 1 nearest the first endpoint of Line 0.
Angle | GetAngle(Dist) | The angle between the directed line segments.
Distance | GetDistance(Dist) | The distance between lines.