bestfit_circle_numpy
- compas.geometry.bestfit_circle_numpy(points)[source]
Fit a circle through a set of points.
- Parameters:
- pointsarray_like[point]
XYZ coordinates of the points.
- Returns:
- [float, float, float]
XYZ coordinates of the center of the circle.
- [float, float, float]
The normal vector of the local frame.
- float
The radius of the circle.
- Raises:
- ValueError
If the number of points is smaller than the dimensionality of the points. At least two points are needed for two-dimensional data. At least three points are needed for three-dimensional data.
See also
Notes
The point of this function is to find the bestfit frame through the given points and transform the points to make the problem 2D.
Once in 2D, the problem simplifies to finding the center point that minimises the difference between the resulting circles for all given points, i.e. minimise in the least squares sense the deviation between the individual radii and the average radius.
For more information see [1].
References
[1]Scipy. Least squares circle. Available at: http://scipy-cookbook.readthedocs.io/items/Least_Squares_Circle.html.