This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 15937 - Clarify that units in the matrices are CSS pixels (editorial)
Summary: Clarify that units in the matrices are CSS pixels (editorial)
Status: RESOLVED FIXED
Alias: None
Product: CSS
Classification: Unclassified
Component: Transforms (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Dirk Schulze
QA Contact: public-css-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-08 16:25 UTC by Simon Fraser
Modified: 2012-10-22 18:56 UTC (History)
6 users (show)

See Also:


Attachments
Intended rendering (with opacity: 0.5) (6.29 KB, image/png)
2012-03-05 20:01 UTC, Simon Fraser
Details

Description Simon Fraser 2012-02-08 16:25:47 UTC
From the F2F, dbaron mentioned that we should clarify that the units the entries in matrices are CSS pixels.
Comment 1 Simon Fraser 2012-03-05 20:01:28 UTC
Created attachment 1086 [details]
Intended rendering (with opacity: 0.5)
Comment 2 Simon Fraser 2012-03-05 20:03:50 UTC
Comment on attachment 1086 [details]
Intended rendering (with opacity: 0.5)

(attached to wrong bug thanks to confusing bugzilla behavior)
Comment 3 Simon Fraser 2012-03-07 05:11:17 UTC
I'm not sure how to word this. Should the wording be in the section that describes the matrix() function? Should it say that the last two parameters are in CSS pixel units? What do we write for matrix3d()?
Comment 4 Dirk Schulze 2012-04-25 16:56:27 UTC
What about:

"Length units in matrices are in CSS pixels." on the general description in the "mathematical description"? Do we have to clarify which units are used for rotations/skews on matrices as well?
Comment 5 Aryeh Gregor 2012-04-29 06:45:04 UTC
The units for matrix() and matrix3d() aren't all pixels.  For matrix(), the first four entries are unitless and the last two are in pixels.  For matrix3d(), entries 0-2, 4-6, 8-10, and 15 (0-indexed) are unitless; entries 12-14 have units of pixels; and entries 3, 7, and 11 have units of 1/pixels.  I.e.,

 [ #    #    #   px]
 [ #    #    #   px]
 [ #    #    #   px]
 [1/px 1/px 1/px # ]

where # is a unitless number.

I don't think we need to say this explicitly.  Instead, we should say how the matrices are used to transform coordinates, and make it clear that the input and output coordinates are in pixels.  The units of the matrix entries will follow from that without having to introduce confusing and unhelpful stuff like 1/px explicitly.
Comment 6 Dirk Schulze 2012-04-29 14:19:24 UTC
(In reply to comment #5)

> I don't think we need to say this explicitly.  Instead, we should say how the
> matrices are used to transform coordinates, and make it clear that the input
> and output coordinates are in pixels.  The units of the matrix entries will
> follow from that without having to introduce confusing and unhelpful stuff like
> 1/px explicitly.

I fully agree. Introducing units for matrices, just to clarify how they are supposed to work is more confusing. But it is more than pixels. How does a matrix reflect a rotation or skewing that use <angle>?
Comment 7 Aryeh Gregor 2012-04-29 14:35:35 UTC
The definition of the matrices for the rotate and skew functions use sin(), cos(), and tan(), which convert angles into pure numbers for use in the pure-number entries of the matrix (the upper left 2x2 or 3x3 block).
Comment 8 Dirk Schulze 2012-04-29 15:18:38 UTC
(In reply to comment #7)
> The definition of the matrices for the rotate and skew functions use sin(),
> cos(), and tan(), which convert angles into pure numbers for use in the
> pure-number entries of the matrix (the upper left 2x2 or 3x3 block).

That means that the matrix operates on degrees, no? Can you phrase a proposal?
Comment 9 Aryeh Gregor 2012-04-30 05:50:46 UTC
No, it means some functions take angles as arguments, and those functions are equivalent to matrices.  Not sure what you mean.

I think this is best fixed after bug 15605.  Once we fix that, we just need to tweak the wording to make it clear that the units of the two-dimensional input and output vectors are in CSS pixels, and then everything is unambiguous.
Comment 10 Dirk Schulze 2012-10-19 04:03:21 UTC
After reading the discussion on this bug, I still think a normative phrase is simpler and still more exact then adding a matrix with px and 1/px. 

""
One translation unit on ''matrix()'' and ''matrix3d()'' is equivalent to 1 pixel in the local coordinate system of the ancestor element.
""

I don't think that we need too mention 1/pixel, since it falls out of the calculation. The text to perspective already describes the relation to translation values. See "3D rendering context"[1].

Any concerns? Otherwise I add it to matrix on the mathematical description section.

[1] http://dev.w3.org/csswg/css3-transforms/#transform-3d-rendering
Comment 11 Dirk Schulze 2012-10-22 18:56:53 UTC
Added the sentence in the mathematical section but used the coordinate system of the element, not the parent. Was wrong from me.