# LineFromNPoints3D

The LineFromNPoints3D function is used to construct a 3D line segment that best fits (and is bound by) the specified 2 or more Point3D input points. The constructed line segment is returned as a Line3D structure.

Inputs

The LineFromNPoints3D function has the following syntax:

LineFromNPoints3D(PointCloud,ExternalPoint0,ExternalPoint1,[ExternalPoint2, ... ExternalPointN],Show)

See the table for a description of the available parameters.

Note: This function can accept a variable number of arguments. Therefore, the function does not have a Property Sheet. After drag-and-dropping from the Toolbox onto the spreadsheet, you must complete it manually according to the above syntax.
Note: You can add each Point3D individually or you can use a range:

Parameter | Description
PointCloud | Reference to a cell containing a point cloud. The default value is $A$0.
External Point 0 | Specifies a reference to a Point3D structure defined in another cell to be used by the function as the first point for constructing the 3D line.
External Point 1 | Specifies a reference to a Point3D structure defined in another cell to be used by the function as the second point for constructing the 3D line.
... |
External Point N | Specifies a reference to a Point3D structure defined in another cell to be used by the function as the Nth point for constructing the 3D line.
Show | Selects the type of graphics to overlay on the image.
0 = hide all (default) | All graphics are hidden, except when the cell containing the function is highlighted in the spreadsheet.
1 = result graphics only | The result graphics of the function are displayed at all times.
2 = input and result graphics | The region of interest, the input data and the results are displayed at all times.

Outputs

Returns | A Line3D data structure as the projected 3D line, or #ERR if any of the input parameters are invalid.
Results | When initially inserted into a cell, the following functions are automatically inserted into the spreadsheet to create a result table.
| X0 | Y0 | Z0 | X1 | Y1 | Z1
❒Line3D | GetX(Line3D, 0) | GetY(Line3D, 0) | GetZ(Line3D, 0) | GetX(Line3D, 1) | GetY(Line3D, 1) | GetZ(Line3D, 1)

Vision Data Access functions

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

Function | Description
GetX(Line3D, index) | Returns the X-axis coordinate of the 3D line point specified with the index. An index value of 0 indicates the first endpoint of the line, while a value of 1 indicates its second endpoint.
GetY(Line3D, index) | Returns the Y-axis coordinate of the 3D line point specified with the index. An index value of 0 indicates the first endpoint of the line, while a value of 1 indicates its second endpoint.
GetZ(Line3D, index) | Returns the Z-axis coordinate of the 3D line point specified with the index. An index value of 0 indicates the first endpoint of the line, while a value of 1 indicates its second endpoint.