Invisible wrote:
> OK, so I'm currently failing to figure this out...
>
> How do you compute the smallest possible (axis-aligned) bounding box for
> an ellipse (which is not necessarily axis-aligned)?
>
> Apparently such an ellipse can be represented as
>
> X(t) = Xc + A cos t cos K - B sin t sin K
> Y(t) = Yc + A cos t sin K + B sin t cos K
>
> Clearly you need to find the minimum and maximum values for X(t) and
> Y(t). But I am apparently too stupid to do this.
When you're looking for the maximum or minimum of a function the first
thing to look for is in general a zero in the derivative.
For example for X:
dX/dt = - A cos K sin t - B sin K cos t
so dX/dt = 0 => A cos K sin t = - B sin K cos t
or assuming A cos K and cos t are not null (you could make special
cases if needed)
tan t = -B/A tan K
so the bounds for X are
X0 = X( atan(-B/A tan K) )
X1 = X( pi + atan(-B/A tan K) )
Sort and do the same for Y...
--
Vincent
Post a reply to this message
|