- rotate your points into a plane
- get the minimum bounding circle of the local XY-coordinates
Finding a circle enclosing data points in a tilted plane
11 views (last 30 days)
Show older comments
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: http://www.mathworks.com/matlabcentral/fileexchange/34767-a-suite-of-minimal-bounding-objects
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.
0 Comments
Accepted Answer
Sven
on 5 Feb 2013
Edited: Sven
on 5 Feb 2013
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: http://www.mathworks.com/matlabcentral/fileexchange/24484
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: http://www.mathworks.com/matlabcentral/fileexchange/34767-a-suite-of-minimal-bounding-objects
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:
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.
2 Comments
Sven
on 5 Feb 2013
No problems. Yeah, I started writing the answer about rotating to the plane... then realised a sphere would do just fine :)
More Answers (0)
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!