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: geometry/Overview.bs
+34-41Lines changed: 34 additions & 41 deletions
Original file line number
Diff line number
Diff line change
@@ -616,27 +616,35 @@ To <dfn>set the dictionary members</dfn> <var>a</var> and <var>b</var> of a {{DO
616
616
<li>Otherwise, set <var>a</var> and <var>b</var> dictionary members to <var>fallback</var>.
617
617
</ol>
618
618
619
+
<h3 id='dommatrix-create'>Creating DOMMatrixReadOnly and DOMMatrix objects</h3>
620
+
621
+
To <dfn>create a 2d matrix</dfn> of type <var>type</var> being either {{DOMMatrixReadOnly}} or {{DOMMatrix}},
622
+
with a sequence <var>numberSequence</var> of 6 elements, follow these steps:
623
+
624
+
1. Let <var>matrix</var> be a new instance of <var>type</var>.
625
+
1. Set <a>m11 element</a>, <a>m12 element</a>, <a>m21 element</a>, <a>m22 element</a>, <a>m41 element</a> and <a>m42 element</a> to the values of <var>numberSequence</var> in order starting with the first value.
626
+
1. Set <a>m31 element</a>, <a>m32 element</a>, <a>m13 element</a>, <a>m23 element</a>, <a>m43 element</a>, <a>m14 element</a>, <a>m24 element</a> and <a>m34 element</a> to ''0''.
627
+
1. Set <a>m33 element</a> and <a>m44 element</a> to ''1''.
628
+
1. Set <a>is2D</a> to <code>true</code>.
629
+
1. Return <var>matrix</var>
630
+
631
+
To <dfn>create a 3d matrix</dfn> with <var>type</var> being either {{DOMMatrixReadOnly}} or {{DOMMatrix}},
632
+
with a sequence <var>numberSequence</var> of 16 elements, follow these steps:
633
+
634
+
1. Let <var>matrix</var> be a new instance of <var>type</var>.
635
+
1. Set <a>m11 element</a> to <a>m44 element</a> to the values of <var>numberSequence</var> in column-major order.
The <dfn dfn-type=constructor dfn-for=DOMMatrixReadOnly><code>DOMMatrixReadOnly(<var>numberSequence</var>)</code></dfn> constructor, when invoked, must run the following steps:
622
642
623
643
<dl class=switch>
624
644
<dt>If <var>numberSequence</var> has 6 elements</dt>
625
-
<dd>
626
-
<ol>
627
-
<li>Set <a>m11 element</a>, <a>m12 element</a>, <a>m21 element</a>, <a>m22 element</a>, <a>m41 element</a>, <a>m42 element</a> to the values of <var>numberSequence</var> in order starting with the first value. Furthermore, set <a>m31 element</a>, <a>m32 element</a>, <a>m13 element</a>, <a>m23 element</a>, <a>m43 element</a>, <a>m14 element</a>, <a>m24 element</a>, <a>m34 element</a> to ''0'' and <a>m33 element</a>, <a>m44 element</a> to ''1''.</li>
628
-
<li>Set <a>is2D</a> to <code>true</code>.</li>
629
-
<li>Return the new <a interface>DOMMatrixReadOnly</a> object.</li>
630
-
</ol>
631
-
</dd>
645
+
<dd>Return the result of invoking <a>create a 2d matrix</a> of type {{DOMMatrixReadOnly}} with the sequence <var>numberSequence</var>.</dd>
632
646
<dt>If <var>numberSequence</var> has 16 elements</dt>
633
-
<dd>
634
-
<ol>
635
-
<li>Set <a>m11 element</a> to <a>m44 element</a> to the values of <var>numberSequence</var> in column-major order.</li>
636
-
<li>Set <a>is2D</a> to <code>false</code>.</li>
637
-
<li>Return the new <a interface>DOMMatrixReadOnly</a> object.</li>
638
-
</ol>
639
-
</dd>
647
+
<dd>Return the result of invoking <a>create a 3d matrix</a> of type {{DOMMatrixReadOnly}} with the sequence <var>numberSequence</var>.</dd>
640
648
<dt>Otherwise</dt>
641
649
<dd>Throw a <code>TypeError</code> exception.</dd>
642
650
</dl>
@@ -648,13 +656,9 @@ The <dfn dfn-type=constructor dfn-for=DOMMatrix><code>DOMMatrix(<var>numberSeque
648
656
649
657
<dl class=switch>
650
658
<dt>If <var>numberSequence</var> has 6 elements</dt>
659
+
<dd>Return the result of invoking <a>create a 2d matrix</a> of type {{DOMMatrix}} with the sequence <var>numberSequence</var>.</dd>
651
660
<dt>If <var>numberSequence</var> has 16 elements</dt>
652
-
<dd>
653
-
<ol>
654
-
<li>Call the constructor of <a interface>DOMMatrixReadOnly</a> with <var>numberSequence</var> as argument.</li>
655
-
<li>Return the new <a interface>DOMMatrix</a> object.</li>
656
-
</ol>
657
-
</dd>
661
+
<dd>Return the result of invoking <a>create a 3d matrix</a> of type {{DOMMatrix}} with the sequence <var>numberSequence</var>.</dd>
658
662
<dt>Otherwise</dt>
659
663
<dd>Throw a <code>TypeError</code> exception.</dd>
660
664
</dl>
@@ -667,13 +671,11 @@ The <dfn dfn-for=DOMMatrix id=dom-dommatrix-frommatrix><code>fromMatrix(<var>oth
667
671
<li>
668
672
<dl class=switch>
669
673
<dt>If the {{DOMMatrixInit/is2D}} dictionary member of <var>other</var> is <code>true</code></dt>
670
-
<dd>Call the constructor of <a interface>DOMMatrixReadOnly</a> with a sequence of numbers, the values being the 16 elements {{DOMMatrixInit/m11}}, {{DOMMatrixInit/m12}}, {{DOMMatrixInit/m13}}, ..., {{DOMMatrixInit/m44}} of <var>other</var> in the given order.</dd>
674
+
<dd>Return the result of invoking <a>create a 2d matrix</a>of type {{DOMMatrix}}with a sequence of numbers, the values being the 6 elements {{DOMMatrixInit/m11}}, {{DOMMatrixInit/m12}}, {{DOMMatrixInit/m21}}, {{DOMMatrixInit/m22}}, {{DOMMatrixInit/m41}} and {{DOMMatrixInit/m42}} of <var>other</var> in the given order.</dd>
671
675
<dt>Otherwise</dt>
672
-
<dd>Call the constructor of <a interface>DOMMatrixReadOnly</a> with a sequence of numbers, the values being the 6 elements {{DOMMatrixInit/m11}}, {{DOMMatrixInit/m12}}, {{DOMMatrixInit/m21}}, {{DOMMatrixInit/m22}}, {{DOMMatrixInit/m41}} and {{DOMMatrixInit/m42}} of <var>other</var> in the given order.</dd>
676
+
<dd>Return the result of invoking <a>create a 3d matrix</a>of type {{DOMMatrix}}with a sequence of numbers, the values being the 16 elements {{DOMMatrixInit/m11}}, {{DOMMatrixInit/m12}}, {{DOMMatrixInit/m13}}, ..., {{DOMMatrixInit/m44}} of <var>other</var> in the given order.</dd>
673
677
</dl>
674
678
</li>
675
-
676
-
<li>Return the new {{DOMMatrix}} object.</li>
677
679
</ol>
678
680
679
681
The <dfn dfn-for=DOMMatrix><code>fromString(<var>transformList</var>)</code></dfn> static method on {{DOMMatrix}} must follow these steps:
@@ -690,28 +692,23 @@ The <dfn dfn-for=DOMMatrix><code>fromString(<var>transformList</var>)</code></df
690
692
</li>
691
693
<li>Transform all <<transform-function>>s to 4x4 matrices by following the “<a href=http://www.w3.org/TR/css-transforms-1/#mathematical-description>Mathematical Description of Transform Functions</a>” [[!CSS3-TRANSFORMS]].</li>
692
694
<li>Let <var>matrix</var> be a 4x4 matrix as shown in the initial figure of this section. Post-multiply all matrices from left to right and set <var>matrix</var> to this product.</li>
693
-
<li>Call the constructor of <a interface>DOMMatrixReadOnly</a> as follows
695
+
<li>
694
696
<dl class=switch>
695
697
<dt>If <var>2dTransform</var> is set to <code>true</code></dt>
696
-
<dd>Call the constructor of <a interface>DOMMatrixReadOnly</a> with a sequence of numbers, the values being the 16 elements of <var>matrix</var>.</dd>
698
+
<dd>Return the result of invoking <a>create a 2d matrix</a>of type {{DOMMatrix}}with a sequence of numbers, the values being the elements<var>m11</var>, <var>m12</var>, <var>21</var>, <var>m22</var>, <var>m41</var> and <var>m42</var> of <var>matrix</var> of <var>matrix</var>.</dd>
697
699
<dt>If <var>2dTransform</var> is set to <code>false</code></dt>
698
-
<dd>Call the constructor of <a interface>DOMMatrixReadOnly</a> with a sequence of numbers, the values being the elements <var>m11</var>, <var>m12</var>, <var>21</var>, <var>m22</var>, <var>m41</var> and <var>m42</var> of <var>matrix</var> of <var>matrix</var>.</dd>
700
+
<dd>Return the result of invoking <a>create a 3d matrix</a>of type {{DOMMatrix}}with a sequence of numbers, the values being the 16 elements of <var>matrix</var>.</dd>
699
701
</dl>
700
702
</li>
701
-
<li>Return the new <a interface>DOMMatrix</a> object.</li>
702
703
</ol>
703
704
704
705
The <dfn dfn-for=DOMMatrix><code>fromFloat32Array(<var>array32</var>)</code></dfn> static method on {{DOMMatrix}} must follow these steps:
705
706
706
707
<dl class=switch>
707
708
<dt>If <var>array32</var> has 6 elements</dt>
709
+
<dd>Return the result of invoking <a>create a 2d matrix</a> of type {{DOMMatrix}} with a sequence of numbers taking the values from <var>array32</var> in the provided order.</dd>
708
710
<dt>If <var>array32</var> has 16 elements</dt>
709
-
<dd>
710
-
<ol>
711
-
<li>Call the constructor of <a interface>DOMMatrixReadOnly</a> with a sequence of numbers taking the values from <var>array32</var> in the provided order.</li>
712
-
<li>Return the new <a interface>DOMMatrix</a> object.</li>
713
-
</ol>
714
-
</dd>
711
+
<dd>Return the result of invoking <a>create a 3d matrix</a> of type {{DOMMatrix}} with a sequence of numbers taking the values from <var>array32</var> in the provided order.</dd>
715
712
<dt>Otherwise</dt>
716
713
<dd>Throw a <code>TypeError</code> exception.</dd>
717
714
</dl>
@@ -720,13 +717,9 @@ The <dfn dfn-for=DOMMatrix><code>fromFloat64Array(<var>array64</var>)</code></df
720
717
721
718
<dl class=switch>
722
719
<dt>If <var>array64</var> has 6 elements</dt>
723
-
<dt>If <var>array64</var> has 16 elements</dt>
724
-
<dd>
725
-
<ol>
726
-
<li>Call the constructor of <a interface>DOMMatrixReadOnly</a> with sequence of numbers taking the values from <var>array64</var> in the provided order.</li>
727
-
<li>Return the new <a interface>DOMMatrix</a> object.</li>
728
-
</ol>
729
-
</dd>
720
+
<dd>Return the result of invoking <a>create a 2d matrix</a> of type {{DOMMatrix}} with a sequence of numbers taking the values from <var>array64</var> in the provided order.</dd>
721
+
<dt>If <var>array32</var> has 16 elements</dt>
722
+
<dd>Return the result of invoking <a>create a 3d matrix</a> of type {{DOMMatrix}} with a sequence of numbers taking the values from <var>array64</var> in the provided order.</dd>
730
723
<dt>Otherwise</dt>
731
724
<dd>Throw a <code>TypeError</code> exception.</dd>
0 commit comments