Re: Bounding box of a group with a transformed child

Kari Pihkala:
...
>The document has a rotated ellipse element in a group element:
><g id="e2">
>   <ellipse id="e1" rx="50" ry="50" transform="translate(100,100) 
>rotate(45)"/>
></g>
>

Due to symmetry reasons one can say already without calculation,
that the boundingBox is '50 50 100 100'.

>The resulting bboxes for e2 are:
>Firefox: 50.011 50.011 99.976 99.976

This is obviously not completely correct, but if the display
area is not too big or one does not scale it up by more than
a factor ~50, at least it will be typically in the error
range given by SVG tiny (below one device pixel), for
SVG full the accuracy should be better.
Note, that the diameter is too small and the translation
too large, it breaks possible symmetries, if such an object
is related to other objects, positioned and oriented in other ways.

I noticed already serious accuray problems in several viewers 
in other areas as well, for example tesselations, pattern, division 
of shapes into pieces to care about problems of the rendering order,
animation, scaling for small viewBoxes or due to transforms and so on.
As an author one has to take into account, that often the accuracy of
viewers is much lower than the requirements for SVG tiny or full.

>Safari: 29.289 29.289 141.421 141.421

Because the ellipse is a circle or radius 50 this is
a pretty surprising result - it seems to multiply the result with
approximately the square root of 2 
(the inverse of the cos/sin of the rotation angle) 
- better not to use information about bounding boxes from this user agent ;o)
My guess - it puts a rectangle around the ellipse and determines the
boundingBox for this shape, not for the ellipse.
Does it put a rectangle as well around other shapes as well? ;o)

>
>Here's jsfiddle to the doc, so you can see the results.
>http://jsfiddle.net/AJYhX/1/

I cannot find any related information about this issue
on that URI, maybe the page has an accessibility problem.
I copied your sample in an own file and set the viewBox to
the determined boundingBox.
Fortunately there is no difference in presentation between
Firefox (28) , Opera (12.16) and Chromium (33, webKit) within 
the accuracy I can see on my monitor.


Olaf

Received on Monday, 26 May 2014 09:14:36 UTC