W3C home > Mailing lists > Public > www-svg@w3.org > May 2014

Re: Bounding box of a group with a transformed child

From: Gavin Kistner <phrogz@me.com>
Date: Tue, 27 May 2014 07:33:56 -0600
Cc: www-svg@w3.org
Message-id: <3F604230-D303-4EE7-BABA-5331C952E16E@me.com>
To: "Dr. Olaf Hoffmann" <Dr.O.Hoffmann@gmx.de>
On May 27, 2014, at 6:37 AM, Dr. Olaf Hoffmann <Dr.O.Hoffmann@gmx.de> wrote:
> Paul LeBeau:
> If one has a good algorithm to determine the boundingBox of an object
> without transformation, the extension to get it right for transformed objects
> should be a solvable problem (because one only has to transform all points 
> and control points of the equivalent paths of the objects and analyse this 
> instead).

You can bake the transforms into the path commands, and then calculate the BBox of those.
I got this mostly working ~3 years ago:
http://stackoverflow.com/questions/5149301/baking-transforms-into-svg-path-element-commands

You could then transform all path commands to absolute to make the bbox calc simpler:
http://phrogz.net/convert-svg-path-to-all-absolute-commands


> Obviously this is more difficult for the stroke of an object.

Correct. Nothing Iíve said above helps with the stroke.
Received on Tuesday, 27 May 2014 13:34:41 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:53 UTC