Hi Burr, what kind of bounding cylinder do you mean exactly, it's not easy to calculate for example the axis direction for which particular axis orientation will have the minimal sized cylinder.
Or do you mean with a fixed axis direction? Even with a fixed direction finding where to place the axis is not necessarily very easy as well unless you are again talking about some kind of fixed value.
Here's an example of why it's not so straightforward - here are a few objects:
The bounding box around them and its center looks like this:
Maybe you were thinking of having the cylinder centered on that same bounding box center point. But look what that gives you:
This is not the tightest cylinder that can be made, see the extra space in this area here:
To get an actual " smallest radius bounding cylinder" you can't just place the cylinder axis at the bounding box center, a cylinder and a box are pretty different in shape so using bounding box information for the cylinder doesn't reallly give the real result for it (there are corners on a box, but no corners on a circle basically), it's something that needs a completely different kind of calculation.
It is possible to put a cylinder that will contain the bounding box so that you know that the object is totally contained inside the cylinder but it won't be the smallest possible one, and I probably would hesitate to make a special command that kind of implied that it was building the actual smallest bounding cylinder when it was not really doing that at all.
What are you planning on using the cylinder for?
- Michael
|