Skip to content

Commit 4a44c27

Browse files
author
cmarrin
committed
tweaks to matrix decomposition wording
1 parent da7a8a5 commit 4a44c27

2 files changed

Lines changed: 20 additions & 21 deletions

File tree

css3-2d-transforms/Overview.html

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ <h3 id=unmatrix><span class=secno>7.2. </span>Unmatrix</h3>
681681
<pre>
682682
Input: matrix ; a 4x4 matrix
683683
Output: translate ; a 3 component vector
684-
rotate ; euler angles, represented as a 3 component vector
684+
rotate ; Euler angles, represented as a 3 component vector
685685
scale ; a 3 component vector
686686
skew ; skew factors XY,XZ,YZ represented as a 3 component vector
687687
perspective ; a 4 component vector
@@ -713,15 +713,15 @@ <h3 id=unmatrix><span class=secno>7.2. </span>Unmatrix</h3>
713713
if (matrix[3][3] == 0)
714714
return false
715715

716-
for (i = 0; i < 4; i++)
717-
for (j = 0; j < 4; j++)
716+
for (i = 0; i &lt; 4; i++)
717+
for (j = 0; j &lt; 4; j++)
718718
matrix[i][j] /= matrix[3][3]
719719

720720
// perspectiveMatrix is used to solve for perspective, but it also provides
721721
// an easy way to test for singularity of the upper 3x3 component.
722722
perspectiveMatrix = matrix
723723

724-
for (i = 0; i < 3; i++)
724+
for (i = 0; i &lt; 3; i++)
725725
perspectiveMatrix[i][3] = 0
726726

727727
perspectiveMatrix[3][3] = 1
@@ -760,7 +760,7 @@ <h3 id=unmatrix><span class=secno>7.2. </span>Unmatrix</h3>
760760
matrix[3][2] = 0
761761

762762
// Now get scale and shear. 'row' is a 3 element array of 3 component vectors
763-
for (i = 0; i < 3; i++)
763+
for (i = 0; i &lt; 3; i++)
764764
row[i][0] = matrix[i][0]
765765
row[i][1] = matrix[i][1]
766766
row[i][2] = matrix[i][2]
@@ -778,7 +778,7 @@ <h3 id=unmatrix><span class=secno>7.2. </span>Unmatrix</h3>
778778
row[1] = normalize(row[1])
779779
skew[0] /= scale[1];
780780

781-
// Compute XZ and YZ shears, orthogonalize 3rd row
781+
// Compute XZ and YZ shears, make 3rd row orthogonal
782782
skew[1] = dot(row[0], row[2])
783783
row[2] = combine(row[2], row[0], 1.0, -skew[1])
784784
skew[2] = dot(row[1], row[2])
@@ -794,8 +794,8 @@ <h3 id=unmatrix><span class=secno>7.2. </span>Unmatrix</h3>
794794
// Check for a coordinate system flip. If the determinant
795795
// is -1, then negate the matrix and the scaling factors.
796796
pdum3 = cross(row[1], row[2])
797-
if (dot(row[0], pdum3) < 0)
798-
for (i = 0; i < 3; i++) {
797+
if (dot(row[0], pdum3) &lt; 0)
798+
for (i = 0; i &lt; 3; i++) {
799799
scale[0] *= -1;
800800
row[i][0] *= -1
801801
row[i][1] *= -1
@@ -818,9 +818,8 @@ <h3 id=animating-the-components><span class=secno>7.3. </span>Animating the
818818
<p> Once decomposed, each component of each returned value of the source
819819
matrix is linearly interpolated with the corresponding component of the
820820
destination matrix. For instance, the translate[0], translate[1] and
821-
translate[2] values are interpolated as any other numeric value (see CSS3
822-
Animations spec), and the result is used to set the translation of the
823-
animating element.
821+
translate[2] values are interpolated numerically, and the result is used
822+
to set the translation of the animating element.
824823

825824
<h3 id=recomposing-the-matrix><span class=secno>7.4. </span>Recomposing the
826825
matrix</h3>

css3-2d-transforms/Overview.src.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ <h3 id="unmatrix">Unmatrix</h3>
627627
<pre>
628628
Input: matrix ; a 4x4 matrix
629629
Output: translate ; a 3 component vector
630-
rotate ; euler angles, represented as a 3 component vector
630+
rotate ; Euler angles, represented as a 3 component vector
631631
scale ; a 3 component vector
632632
skew ; skew factors XY,XZ,YZ represented as a 3 component vector
633633
perspective ; a 4 component vector
@@ -659,15 +659,15 @@ <h3 id="unmatrix">Unmatrix</h3>
659659
if (matrix[3][3] == 0)
660660
return false
661661

662-
for (i = 0; i < 4; i++)
663-
for (j = 0; j < 4; j++)
662+
for (i = 0; i &lt; 4; i++)
663+
for (j = 0; j &lt; 4; j++)
664664
matrix[i][j] /= matrix[3][3]
665665

666666
// perspectiveMatrix is used to solve for perspective, but it also provides
667667
// an easy way to test for singularity of the upper 3x3 component.
668668
perspectiveMatrix = matrix
669669

670-
for (i = 0; i < 3; i++)
670+
for (i = 0; i &lt; 3; i++)
671671
perspectiveMatrix[i][3] = 0
672672

673673
perspectiveMatrix[3][3] = 1
@@ -706,7 +706,7 @@ <h3 id="unmatrix">Unmatrix</h3>
706706
matrix[3][2] = 0
707707

708708
// Now get scale and shear. 'row' is a 3 element array of 3 component vectors
709-
for (i = 0; i < 3; i++)
709+
for (i = 0; i &lt; 3; i++)
710710
row[i][0] = matrix[i][0]
711711
row[i][1] = matrix[i][1]
712712
row[i][2] = matrix[i][2]
@@ -724,7 +724,7 @@ <h3 id="unmatrix">Unmatrix</h3>
724724
row[1] = normalize(row[1])
725725
skew[0] /= scale[1];
726726

727-
// Compute XZ and YZ shears, orthogonalize 3rd row
727+
// Compute XZ and YZ shears, make 3rd row orthogonal
728728
skew[1] = dot(row[0], row[2])
729729
row[2] = combine(row[2], row[0], 1.0, -skew[1])
730730
skew[2] = dot(row[1], row[2])
@@ -740,8 +740,8 @@ <h3 id="unmatrix">Unmatrix</h3>
740740
// Check for a coordinate system flip. If the determinant
741741
// is -1, then negate the matrix and the scaling factors.
742742
pdum3 = cross(row[1], row[2])
743-
if (dot(row[0], pdum3) < 0)
744-
for (i = 0; i < 3; i++) {
743+
if (dot(row[0], pdum3) &lt; 0)
744+
for (i = 0; i &lt; 3; i++) {
745745
scale[0] *= -1;
746746
row[i][0] *= -1
747747
row[i][1] *= -1
@@ -762,8 +762,8 @@ <h3>Animating the components</h3>
762762
<p>
763763
Once decomposed, each component of each returned value of the source matrix is linearly interpolated
764764
with the corresponding component of the destination matrix. For instance, the translate[0],
765-
translate[1] and translate[2] values are interpolated as any other numeric value (see CSS3
766-
Animations spec), and the result is used to set the translation of the animating element.
765+
translate[1] and translate[2] values are interpolated numerically, and the result is used to set the
766+
translation of the animating element.
767767
</p>
768768
<h3>Recomposing the matrix</h3>
769769
<p><em>This section is not normative.</em></p>

0 commit comments

Comments
 (0)