# LineFromNPoints

Constructs a line from a list of points.

Inputs

Parameter | Description
Image | This argument must reference a spreadsheet cell that contains a valid Image data structure. By default, the cell referenced is cell A1.
Point 0 | Specifies the coordinates of the first point.
Point X 0 | The X coordinate of the first point.
Point Y 0 | The Y coordinate of the first point.
Point 1 | Specifies the coordinates of the second point.
Point X 1 | The X coordinate of the second point.
Point Y 1 | The Y coordinate of the second point.
Point 2..N | Specifies the coordinates of any additional points.
Point X N | The X coordinate of the Nth point.
Point Y N | The Y coordinate of the Nth point.
Show | Specifies the graphics items to be displayed on a permanent basis.
0 = hide all | All graphics items are hidden except when the cell containing the LineFromNPoints function is the active cell in the spreadsheet.
1 = result graphics only | The fitted line graphic is displayed at all times. The input points are only displayed when the cell containing the LineFromNPoints function is the active cell in the spreadsheet.
2 = input and result graphics | The fitted line and the input points are displayed at all times.

Outputs

Returns | A LineFit data structure if two or more valid points are included in data, or #ERR if only one or no valid point is included in data.
Results | When the function is initially inserted into a cell, the following LineFit Vision Data Access functions are automatically inserted into the spreadsheet to create a result table:
Label | Function | Description
X0 | GetX(LineFit, 0) | The X coordinate of the first endpoint.
Y0 | GetY(LineFit, 0) | The Y coordinate of the first endpoint.
X1 | GetX(LineFit, 1) | The X coordinate of the second endpoint.
Y1 | GetY(LineFit, 1) | The Y coordinate of the second endpoint.
Chi2 | GetChi2(LineFit) | The sum of the squares of the distances from the points to the line.
Additional data elements can be accessed using the following Vision Data Access functions:
Label | Function | Description
--- | --- | ---
Distance | GetDistance(LineFit, Index) | The distance between the indexed point and the line.
MaxDist | GetMaxDist(LineFit) | The point that is farthest from the line.
MaxDistIndex | GetMaxDistIndex(LineFit) | The index of the point that is farthest from the line.
NPointsUsed | GetNPointsUsed(LineFit) | The number of points used to compute the line.