Hi Michael,
"Bishop, Michael W. CONTR J9C880" <[EMAIL PROTECTED]> wrote on
12/12/2005 05:12:02 PM:
> One more question here. How can a bounding box take rotation into
> account? If I draw an Element that's wider than it is tall, then draw a
> bounding box around it, it looks fine. If I rotate it 90 degrees so
> it's taller than it is wide, the bounding box still conforms to the
> element before rotating. I don't want to rotate the bounding box;
Why not? this is what is typically done...
> I want it to be big enough to bound the element in any rotation. Is
there
> a way to do this?
There are two ways to get this, the 'correct' and the 'simple'.
The simple is to use Pythagoras on the BBox to get the length of
the diagonal for the BBox. You can be sure that no BBox will fall
outside of a square of this size:
max = sqrt(bbox.width*bbox.width + bbox.height*bbox.height);
rect.w = rect.h = max;
This may significantly over-estimate the needed rect (take a circle
for example). The 'correct' answer is to calculate the farthest point on
the curve from the center of the object. This could be done on a
tesselated version of the curve fairly simply although rather slowly.
It would likely be faster to compute the Convex Hull and then calculate
the farthest point on that.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]