Method for fitting a circe through a set of points


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.

Many thanks!

Fit Circle is a combination of Rhinocommon Sphere.FitSphereToPoints and Plane.FitPlaneToPoints. Then you intersect the plane and sphere.

Fit (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?

Hi @mathias_gmachl,

I am not seeing a better way at this time.

– Dale

1 Like

Thanks @dale. I’ll keep an eye on it.

Hi @mathias_gmachl,

Looks like a new Rhino.Geometry.Circle.TryFitCircleToPoints static function will make it into SR2.

– Dale


Thanks @dale !
This is now at least 10 times as fast and allows Kangaroo 2 to converge in seconds.

1 Like