You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: matrix/index.html
+53-22Lines changed: 53 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -46,12 +46,12 @@
46
46
</p>
47
47
48
48
<p>
49
-
The transformation matrix interface replaces the SVGMatrix interface from SVG [[SVG11]]. It is a common interface used to describe 2D and 3D transformations on a graphical context for SVG, Context2D [[CANVAS-2D]], CSS3 Transforms [[CSS3-TRANSFORMS]]<!-- and WebGL [[WEBGL]] -->.
49
+
The transformation matrix interface replaces the SVGMatrix interface from SVG [[SVG11]]. It is a common interface used to describe 2D and 3D transformations on a graphical context for SVG, Canvas 2D Context [[CANVAS-2D]] and CSS Transforms [[CSS3-TRANSFORMS]]<!-- and WebGL [[WEBGL]] -->.
50
50
</p>
51
51
</section>
52
52
53
53
<section>
54
-
<h2>Definitions</h2>
54
+
<h2>Terminology</h2>
55
55
<dl>
56
56
<dt><dfn>post-multiply</dfn></dt>
57
57
<dd>Term A post-multiplied by term B is equal to A · B.</dd>
The <a>CSSMatrix</a> interface represents a mathematical matrix with the purpose of describing transformations a graphical contexts. The following sections describe the details of the interface. For the full interface see <ahref="#webidl-ref">Interface summary</a>.
135
135
</p>
136
136
137
+
<divclass="figure">
138
+
<imgsrc="images/4x4matrix.png" alt="4x4 matrix with items m11 to m44">
139
+
<pclass="capture">A 4x4 matrix representing a <a>CSSMatrix</a> with items m11 to m44.</p>
140
+
</div>
141
+
142
+
<pclass="issue">It needs to be decided if CSSMatrix stored single or double precision floating point numbers.</p>
<dd>Optional translation value along the z-axis.</dd>
385
392
</dl>
386
-
Post-multiplies a translation transformation on the current matrix and returns the resulting matrix. The current matrix is not modified.
393
+
<p>Post-multiplies a translation transformation on the current matrix and returns the resulting matrix. The current matrix is not modified.</p>
394
+
<p>The 3D translation matrix is <ahref="http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#Translate3dDefined">described</a> in CSS Transforms [[!CSS3-TRANSFORMS]].</p>
Post-multiplies a uniform 2D scale transformation (<code>m11 = m22 = scale</code>) on the current matrix with the given origin and returns the resulting matrix. The current matrix is not modified.
406
+
<p>Post-multiplies a uniform 2D scale transformation (<code>m11 = m22 = scale</code>) on the current matrix with the given origin and returns the resulting matrix. The current matrix is not modified.</p>
407
+
<p>The 2D scale matrix is <ahref="http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#ScaleDefined">described</a> in CSS Transforms with <code>sx = sy = scale</code>. This does not include the origin translation. [[!CSS3-TRANSFORMS]].</p>
Post-multiplies a uniform scale transformation (<code>m11 = m22 = m33 = scale</code>) on the current matrix with the given origin and returns the resulting matrix. The current matrix is not modified.
421
+
<p>Post-multiplies a uniform scale transformation (<code>m11 = m22 = m33 = scale</code>) on the current matrix with the given origin and returns the resulting matrix. The current matrix is not modified.</p>
422
+
<p>The 3D scale matrix is <ahref="http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#Scale3dDefined">described</a> in CSS Transforms with <code>sx = sy = sz = scale</code>. This does not include the origin translation. [[!CSS3-TRANSFORMS]].</p>
Post-multiplies a non-uniform scale transformation on the current matrix with the given origin and returns the resulting matrix. The current matrix is not modified.
440
+
<p>Post-multiplies a non-uniform scale transformation on the current matrix with the given origin and returns the resulting matrix. The current matrix is not modified.</p>
441
+
<p>The 3D scale matrix is <ahref="http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#Scale3dDefined">described</a> in CSS Transforms with <code>sx = scaleX</code>, <code>sy = scaleY</code> and <code>sz = scaleZ</code>. This does not include the origin translation. [[!CSS3-TRANSFORMS]].</p>
Post-multiplies a rotation transformation on the current matrix with the given origin and returns the resulting matrix. The current matrix is not modified.
453
+
<p>Post-multiplies a rotation transformation on the current matrix with the given origin and returns the resulting matrix. The current matrix is not modified.</p>
454
+
<p>The 2D rotation matrix is <ahref="http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#RotateDefined">described</a> in CSS Transforms with <code>alpha = angle</code>. This does not include the origin translation. [[!CSS3-TRANSFORMS]].</p>
<dd>The x coordinate of the vector (x,y). Must not be zero.</dd>
460
+
<dd>The x coordinate of the vector (x,y)<sup>T</sup>.</dd>
449
461
<dt>unrestricted double y</dt>
450
-
<dd>The y coordinate of the vector (x,y). Must not be zero.</dd>
462
+
<dd>The y coordinate of the vector (x,y)<sup>T</sup>.</dd>
451
463
</dl>
452
-
Post-multiplies a rotation transformation on the current matrix and returns the resulting matrix. The rotation angle is determined by taking (+/-) atan(y/x). The direction of the vector (x, y) determines whether the positive or negative angle value is used. The current matrix is not modified.
464
+
<p>Post-multiplies a rotation transformation on the current matrix and returns the resulting matrix. The rotation angle is determined by the angle between the vector (1,0)<sup>T</sup> and (x,y)<sup>T</sup> in the clockwise direction. If <code>x</code> and <code>y</code> should both be zero, the angle is specified as zero. The current matrix is not modified.</p>
465
+
<p>The 2D rotation matrix is <ahref="http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#RotateDefined">described</a> in CSS Transforms where <code>alpha</code> is the angle between the vector (1,0)<sup>T</sup> and (x,y)<sup>T</sup> in degrees [[!CSS3-TRANSFORMS]].</p>
Post-multiplies a rotation transformation on the current matrix and returns the resulting matrix. The rotation of the transform is applied around the given vector. The current matrix is not modified.
466
478
</dl>
479
+
<p>Post-multiplies a rotation transformation on the current matrix and returns the resulting matrix. The rotation of the transform is applied around the given vector. The current matrix is not modified.</p>
480
+
<p>The 3D rotation matrix is <ahref="http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#Rotate3dDefined">described</a> in CSS Transforms with <code>alpha = angle</code> [[!CSS3-TRANSFORMS]].</p>
467
481
</dd>
468
482
<dt>CSSMatrix skewX()</dt>
469
483
<dd>
470
484
<dlclass='parameters'>
471
485
<dt>unrestricted double sx</dt>
472
486
<dd>Skew angle along the x-axis in degrees.</dd>
473
487
</dl>
474
-
Post-multiplies a skewX transformation on the current matrix and returns the resulting matrix. The current matrix is not modified.
488
+
<p>Post-multiplies a skewX transformation on the current matrix and returns the resulting matrix. The current matrix is not modified.</p>
489
+
<p>The 2D skewX matrix is <ahref="http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#SkewXDefined">described</a> in CSS Transforms with <code>alpha = sx</code> [[!CSS3-TRANSFORMS]].</p>
475
490
</dd>
476
491
<dt>CSSMatrix skewY()</dt>
477
492
<dd>
478
493
<dlclass='parameters'>
479
494
<dt>unrestricted double sy</dt>
480
495
<dd>Skew angle along the y-axis in degrees.</dd>
481
496
</dl>
482
-
Post-multiplies a skewX transformation on the current matrix and returns the resulting matrix.
497
+
<p>Post-multiplies a skewX transformation on the current matrix and returns the resulting matrix.</p>
498
+
<p>The 2D skewY matrix is <ahref="http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#SkewYDefined">described</a> in CSS Transforms with <code>beta = sy</code> [[!CSS3-TRANSFORMS]].</p>
<dd>Optional translation value along the z-axis.</dd>
542
558
</dl>
543
-
Post-multiplies a translation transformation on the current matrix.
559
+
<p>Post-multiplies a translation transformation on the current matrix.</p>
560
+
<p>The 3D translation matrix is <ahref="http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#Translate3dDefined">described</a> in CSS Transforms [[!CSS3-TRANSFORMS]].</p>
Post-multiplies a uniform 2D scale transformation (<code>m11 = m22 = scale</code>) on the current matrix with the given origin.
572
+
<p>Post-multiplies a uniform 2D scale transformation (<code>m11 = m22 = scale</code>) on the current matrix with the given origin.</p>
573
+
<p>The 2D scale matrix is <ahref="http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#ScaleDefined">described</a> in CSS Transforms with <code>sx = sy = scale</code>. This does not include the origin translation. [[!CSS3-TRANSFORMS]].</p>
Post-multiplies a uniform 2D scale transformation (<code>m11 = m22 = m33 = scale</code>) on the current matrix with the given origin.
587
+
<p>Post-multiplies a uniform 2D scale transformation (<code>m11 = m22 = m33 = scale</code>) on the current matrix with the given origin.</p>
588
+
<p>The 3D scale matrix is <ahref="http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#Scale3dDefined">described</a> in CSS Transforms with <code>sx = sy = sz = scale</code>. This does not include the origin translation. [[!CSS3-TRANSFORMS]].</p>
Post-multiplies a non-uniform scale transformation on the current matrix with the given origin.
606
+
<p>Post-multiplies a non-uniform scale transformation on the current matrix with the given origin.</p>
607
+
<p>The 3D scale matrix is <ahref="http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#Scale3dDefined">described</a> in CSS Transforms with <code>sx = scaleX</code>, <code>sy = scaleY</code> and <code>sz = scaleZ</code>. This does not include the origin translation. [[!CSS3-TRANSFORMS]].</p>
Post-multiplies a rotation transformation on the current matrix with the given origin.
619
+
<p>Post-multiplies a rotation transformation on the current matrix with the given origin.</p>
620
+
<p>The 2D rotation matrix is <ahref="http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#RotateDefined">described</a> in CSS Transforms with <code>alpha = angle</code>. This does not include the origin translation. [[!CSS3-TRANSFORMS]].</p>
<dd>The y coordinate of the vector (x,y). Must not be zero.</dd>
608
629
</dl>
609
-
Post-multiplies a rotation transformation on the current matrix. The rotation angle is determined by taking (+/-) atan(y/x). The direction of the vector (x, y) determines whether the positive or negative angle value is used.
630
+
<p>Post-multiplies a rotation transformation on the current matrix. The rotation angle is determined by the angle between the vector (1,0)<sup>T</sup> and (x,y)<sup>T</sup> in the clockwise direction. If <code>x</code> and <code>y</code> should both be zero, the angle is specified as zero.</p>
631
+
<p>The 2D rotation matrix is <ahref="http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#RotateDefined">described</a> in CSS Transforms where <code>alpha</code> is the angle between the vector (1,0)<sup>T</sup> and (x,y)<sup>T</sup> in degrees [[!CSS3-TRANSFORMS]].</p>
Post-multiplies a rotation transformation on the current matrix. The rotation of the transform is applied around the given vector.
623
644
</dl>
645
+
<p>Post-multiplies a rotation transformation on the current matrix. The rotation of the transform is applied around the given vector.</p>
646
+
<p>The 3D rotation matrix is <ahref="http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#Rotate3dDefined">described</a> in CSS Transforms with <code>alpha = angle</code> [[!CSS3-TRANSFORMS]].</p>
624
647
</dd>
625
648
<dt>void skewXBy()</dt>
626
649
<dd>
627
650
<dlclass='parameters'>
628
651
<dt>unrestricted double sx</dt>
629
652
<dd>Skew angle along the x-axis in degrees.</dd>
630
653
</dl>
631
-
Post-multiplies a skewX transformation on the current matrix.
654
+
<p>Post-multiplies a skewX transformation on the current matrix.</p>
655
+
<p>The 2D skewX matrix is <ahref="http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#SkewXDefined">described</a> in CSS Transforms with <code>alpha = sx</code> [[!CSS3-TRANSFORMS]].</p>
632
656
</dd>
633
657
<dt>void skewYBy()</dt>
634
658
<dd>
635
659
<dlclass='parameters'>
636
660
<dt>unrestricted double sy</dt>
637
661
<dd>Skew angle along the y-axis in degrees.</dd>
638
662
</dl>
639
-
Post-multiplies a skewX transformation on the current matrix.
663
+
<p>Post-multiplies a skewX transformation on the current matrix.</p>
664
+
<p>The 2D skewY matrix is <ahref="http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#SkewYDefined">described</a> in CSS Transforms with <code>beta = sy</code> [[!CSS3-TRANSFORMS]].</p>
640
665
</dd>
641
666
<dt>void invert()</dt>
642
667
<dd>
@@ -706,6 +731,12 @@ <h3>Helper methods</h3>
706
731
</dl>
707
732
</section>
708
733
</section>
734
+
735
+
<section>
736
+
<h2>Transformation to a 3x2 matrix</h2>
737
+
<p>Host languages might require an internal 3x2 matrix abstraction of a <a>CSSMatrix</a>. This transformation from a 4x4 matrix to a 3x2 by loosing information is described in section <ahref="http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#MatrixDefined">Mathematical Description of Transform Functions</a> of CSS Transforms [[!CSS3-TRANSFORMS]].</p>
0 commit comments