Find best-fit circle (automatically)
338 4 0- element33
- Member
- 82 posts
- Joined: Jan. 2015
- Offline
I have a slightly uneven poly circle. Is there a way to automatically (not manually) find the best-fit circle, i.e. one that minimizes the sum of distances from the poly? It's like finding a "best fit plane" for near-planar points, but for a circle. There's a "Fit Curve" SOP, but it seems to create a very close NURBS approximation of the shape, not a perfect circle.
Edited by element33 - Dec. 30, 2024 00:44:23
- johnmather
- Staff
- 534 posts
- Joined: Aug. 2019
- Offline
- element33
- Member
- 82 posts
- Joined: Jan. 2015
- Offline
- johnmather
- Staff
- 534 posts
- Joined: Aug. 2019
- Offline
In that case, you can approximate the result algebraically by performing something like this: https://scipy-cookbook.readthedocs.io/items/Least_Squares_Circle.html#Using-an-algebraic-approximation [scipy-cookbook.readthedocs.io]
I've attached a hip file that should do what you want. If you scrub the timeline, you'll be able to see the results for different inputs.
I've attached a hip file that should do what you want. If you scrub the timeline, you'll be able to see the results for different inputs.
- element33
- Member
- 82 posts
- Joined: Jan. 2015
- Offline
-
- Quick Links