MATLAB Answers


Finding a circle enclosing data points in a tilted plane

Asked by Doctor61 on 5 Feb 2013

My input is x,y,z coordinates of some data points lying in a tilted plane. I am trying to find a way to compute the minimum radius circle enclosing these data.

I have looked at the minboundcircle(x,y,hullflag) here:

but it only works when the points are in the x-y plane. I know I can rotate and translate my points to bring them in x-y plane, but I am looking for an easier way.

I have also considered using convhulln() but it does not work, apparently because all my points are coplanar.

Any help is much appreciated.


Log in to comment.

1 Answer

Answer by Sven
on 5 Feb 2013
Edited by Sven
on 5 Feb 2013
 Accepted Answer

Hi Doctor61,

First, from your previous posts and this one I see that you're doing lots of stuff with 3d geometry. I think that you will find this FEX entry very very useful:

However, if I understand your problem correctly I think there's a simple answer. My understanding is that you have a set of planar points and you want to find the radius of a circle tilted to that plane that would enclose them.

If the points are indeed exactly coplanar, then a minimum bounding sphere of the points in 3D would actually have the same radius as the circle you describe.

In that case, let me point you towards:

It has a minboundsphere which would do the job.

If your points aren't exactly coplanar, then what you're actually talking about is a minimum bounding cylinder, tilted to align with the plane. In that case, I think that you'll find that the easiest way to answer the question is to:

  1. rotate your points into a plane
  2. get the minimum bounding circle of the local XY-coordinates

The good news is that with geom3d it's actually very easy to do this. If you don't have your plane (but you know 3 points lying on that plane), you can get it by:

myPlane = createPlane(P1, P2, P3);

Then you can get local coordinates of those points by transforming them:

Tform = createBasisTransform3d('global', myPlane);
PTS_WRT_PLANE = transformPoint3d(myPts, Tform);

At this point, your task of finding a minimum bounding circle gets quite a bit easier because we're only working in 2d. John D'Errico's suite of minimal-bounding-objects also has a minboundcircle.

Thanks, Sven.


Thank you Sven. very helpful. I guess the sphere should work perfectly fine since it also provides me with the centre of the enclosing circle. I will check out FEX too. Thanks again.

No problems. Yeah, I started writing the answer about rotating to the plane... then realised a sphere would do just fine :)

Log in to comment.

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today