Sometimes I have to put text on a path

Friday, July 25, 2008

matlab .m Minimum Radius Bounding Sphere

http://www.mathworks.de/matlabcentral/fileexchange/loadFile.do?objectId=13758&objectType=file

MINBOUNDSPHERE is an extension of my MINBOUNDCIRCLE code, to run on 3-d data. It computes the minimum radius enclosing sphere around 3-d data.

>> xyz = randn(1000,3);
>> tic,[c,r] = minboundsphere(xyz),toc
Elapsed time is 0.049200 seconds.

c =
-0.096207 -0.12586 0.090616

r =
4.0176

Note that the generated sphere must pass through at least 2 of the points provided.

MINBOUNDSPHERE should return the correct finite radius sphere even for only 2 or 3 points, or where the points are nearly collinear or coplanar, so that the circum-sphere would normally have infinite or near infinite radius.

Use is made of convhulln to improve run time. If there is a perceived need, I could allow the user to turn off the call to convhulln when desired, or modify the convhulln call to be compatible with older Matlab releases. Please send me e-mail if this feature would be of value.

No comments:

Post a Comment