I have been trying to locate the correct Method in Rhino.Common that attempts to fit a circle through a collection of points.
There is a method in Rhino.Geometry Sphere.Structure to do this
and I there is a command in Rhino and a component in GH to do the same for circles, but I just cant find how or where.
Fit Circle is a combination of Rhinocommon Sphere.FitSphereToPoints and Plane.FitPlaneToPoints. Then you intersect the plane and sphere.
So this could look something like this
Sphere S = Sphere.FitSphereToPoints(Pts);
Plane Pl = new Plane();
Plane.FitPlaneToPoints(Pts, out Pl);
Circle C = new Circle();
Rhino.Geometry.Intersect.Intersection.PlaneSphere(Pl, S, out C);
Or is there a more elegant way?
I am not seeing a better way at this time.
Thanks @dale. I’ll keep an eye on it.
Looks like a new
Rhino.Geometry.Circle.TryFitCircleToPoints static function will make it into SR2.
Thanks @dale !
This is now at least 10 times as fast and allows Kangaroo 2 to converge in seconds.