W3C home > Mailing lists > Public > public-fx@w3.org > October to December 2013

Re: [css-transforms][svg11] Effect of perspective and 3D transform on SVG bounding box

From: Dirk Schulze <dschulze@adobe.com>
Date: Mon, 14 Oct 2013 22:10:07 -0700
To: "robert@ocallahan.org" <robert@ocallahan.org>
CC: "public-fx@w3.org" <public-fx@w3.org>
Message-ID: <79A4A435-2220-4C51-A989-4622FA920393@adobe.com>

On Oct 15, 2013, at 12:26 AM, Robert O'Callahan <robert@ocallahan.org> wrote:

> On Mon, Oct 14, 2013 at 4:58 PM, Dirk Schulze <dschulze@adobe.com> wrote:
> SVG defines the bounding box of an object as follows [1]:
> ""
> getBBox(): Returns the tight bounding box in current user space (i.e., after application of the ‘transform’attribute, if any) on the geometry of all contained graphics elements
> ""
> The question is what is the effect of 3D transforms on the bounding box? I assume that there wouldn't be a big difference. It would still be the tight bounding box of the contained elements after transformations.
> More interesting, what is with a perspective projection matrix? Would it affect the bounding box as well? After all, the perspective projection matrix is not very different from a CSS transform which can have perspective values as well. Therefore, I would assume that all the properties: transform, transform-origin, perspective and perspective-origin have an effect on the object bounding box.
> Right, that seems logical to me too.


> Unfortunately this creates a problem:
> 1) Evaluating the 'perspective-origin' of an SVG element requires knowing its SVG bounding box.

That is right.

> 2) Its SVG bounding box depends on the transformations of its children.

Right. And as discussed on the perspective projection matrix as well.

> 3) The transformations of its children depend on the 'perspective-origin' of the parent.

I do not understand how this would be the case? 'perspective-origin' is like two perspective projection matrices that surround the one specified by the 'perspective' property. Or to be clear: The perspective projection matrix is specified by the 'perspective' and 'perspective-origin' properties. This matrix gets multiplied with the transformation matrix that is specified by the 'transform' and 'transform-origin' properties.

You are right that 'transform', 'perspective' and 'perspective-origin' may depend on the objects bounding box (which depends on the transformation and oob of the children). I do not see a requirement of the children to know the 'perspective-origin' of the parent? Also, why would it then just be the 'perspective-origin' and not the 'perspective' as well? From the spec [1]:

It effectively sets the X and Y position at which the viewer appears to be looking at the children of the element.


[1] http://dev.w3.org/csswg/css-transforms/#perspective-origin-property

> Any suggestions for resolving this? I don't see any obvious solution :-(.
> Rob
> -- 
> Jtehsauts  tshaei dS,o n" Wohfy  Mdaon  yhoaus  eanuttehrotraiitny  eovni le atrhtohu gthot sf oirng iyvoeu rs ihnesa.r"t sS?o  Whhei csha iids  teoa stiheer :p atroa lsyazye,d  'mYaonu,r  "sGients  uapr,e  tfaokreg iyvoeunr, 'm aotr  atnod  sgaoy ,h o'mGee.t"  uTph eann dt hwea lmka'n?  gBoutt  uIp  waanndt  wyeonut  thoo mken.o w  
Received on Tuesday, 15 October 2013 05:10:39 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:49:47 UTC