Hi,
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
http://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Sphere_FitSphereToPoints.htm
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.
Many thanks!
Mathias
Fit Circle is a combination of Rhinocommon Sphere.FitSphereToPoints and Plane.FitPlaneToPoints . Then you intersect the plane and sphere.
Fit Circle.gh (5.7 KB)
Thanks, Michael.
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?
dale
(Dale Fugier)
January 18, 2018, 5:48pm
4
1 Like
Thanks @dale . I’ll keep an eye on it.
dale
(Dale Fugier)
January 23, 2018, 4:11pm
6
Hi @mathias_gmachl ,
Looks like a new Rhino.Geometry.Circle.TryFitCircleToPoints
static function will make it into SR2.
– Dale
4 Likes
Thanks @dale !
This is now at least 10 times as fast and allows Kangaroo 2 to converge in seconds.
1 Like