# CircleFromNPoints

Constructs a circle from a list of points.

Inputs

The CircleFromNPoints 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:

CircleFromNPoints(Image, Point X 0, Point Y 0, Point X 1, Point X 1, Point Y 1, Point X 2, Point Y 2, [Point X 3, Point Y 3, …, 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 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 | Specifies the coordinates of the third point.
Point X 2 | The X coordinate of the third point.
Point Y 2 | The Y coordinate of the third point.
Point 3..N | Optionally 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 CircleFromNPoints function is the active cell in the spreadsheet.
1 = result graphics only | The fitted circle graphic is displayed at all times. The input points are only displayed when the cell containing the CircleFromNPoints function is the active cell in the spreadsheet.
2 = input and result graphics | The fitted circle and the input points are displayed at all times.

Outputs

Returns | A CircleFit data structure containing the X, Y, radius, and sigma of the fitted circle.
Results | When the function is initially inserted into a cell, the following CircleFit Vision Data Access functions are automatically inserted into the spreadsheet to create a result table:
Label | Function | Description
X | GetX(CircleFit) | The X coordinate of the center of the circle.
Y | GetY(CircleFit) | The Y coordinate of the center of the circle.
Radius | GetRadius(CircleFit) | The radius of the circle.
Sigma | GetSigma(CircleFit) | The square root of the sum of the squares of the distances from the points to the circle divided by the number of points.
Additional data elements can be accessed using the following Vision Data Access functions :
Label | Function | Description
--- | --- | ---
Distance | GetDistance(CircleFit, Index) | The distance between the indexed point and the circle. If the value is negative, the point is within the circle. If the indexed point is invalid, an #ERR is returned.
MaxDist | GetMaxDist(CircleFit) | The distance between the circle and the point farthest from the circle. If the value is negative, the point is within the circle.
MaxDistIndex | GetMaxDistIndex(CircleFit) | The index of the point farthest from the circle.
NPointsUsed | GetNPointsUsed(CircleFit) | The number of points used to fit the circle.