Oh goodie !

Thanks for bringing that to my attention :)

In that case - I'd say - traverse the curve and find the max-min x 
and y coords for the curve itself.

The parametric equations will be

x = a3*u^3 + a2*u^2 + a1*u + a0

y = b3*u^3 + b2*u^2 + b1*u + b0

where the a's and the b's are given as...

a3 = (x3 + 3(x1 - x2) - x0)/8
a2 = (3(x3 - x2 - x1 + x0))/8
a1 = (x3 - x0)/2 - a3
a0 = (x3 + x0)/2 - a2

b3 = (y3 + 3(y1 - y2) - y0)/8
b2 = (3(y3 - y2 - y1 + y0))/8
b1 = (b3 - b0)/2 - b3
b0 = (y3 + y0)/2 - b2

varying the value of u from -1 to 1 you'll traverse the entire curve.
Just keep updating your maxX and maxY with the maximum values you get 
of x and y throughout this traversal.

This shall form your bounding box :)

hope this helps.

-Arvind

--- In [email protected], Fernando Silva 
<[EMAIL PROTECTED]> wrote:
> Thanks for your attention.
> Well, let's see the following example that draws a bezier curve
> 
> <path d="M100,200 C100,100 250,100 250,200" />
> 
> if we use the min/max the bounding box would be (100,100 250,200)
> but after drawing it with inkscape it's easy to see that would be 
not
> the real bounding box...
> 
> Thanks,
>   Fernando Silva
> 
> On 8/17/05, buddy4n <[EMAIL PROTECTED]> wrote:
> > If along the axis - that should be a method to detect the maximum 
and
> > minimum x and y coordinates through All control points of the 
path.
> > 
> > cheers.
> > it's bubbling up the max and min :)
> > 
> > If you have any other requirements, I wouldn't know it yet :)
> > -Arvind
> > 
> > --- In [email protected], Fernando Silva 
<[EMAIL PROTECTED]>
> > wrote:
> > > Hi guys,
> > >
> > > I'm trying to calculate the bounding box of an element 
*without* using
> > > getBBox(). If for shapes it's easy to calculate it, what is the
> > > formula to calculate the BBox for a "path"?
> > >
> > > Thanks,
> > >   Fernando Silva
> > 
> > 
> > 
> > 
> > 
> > -----
> > To unsubscribe send a message to: svg-developers-
[EMAIL PROTECTED]
> > -or-
> > visit http://groups.yahoo.com/group/svg-developers and 
click "edit my membership"
> > ----
> > Yahoo! Groups Links
> > 
> > 
> > 
> > 
> > 
> > 
> >





------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12hm6b64n/M=362329.6886308.7839368.1510227/D=groups/S=1706030389:TM/Y=YAHOO/EXP=1124315754/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992
">Fair play? Video games influencing politics. Click and talk back!</a>.</font>
--------------------------------------------------------------------~-> 

-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to