and internally all calculations are performed using column-major ordering. However, as the actual ordering
and internally all calculations are performed using column-major ordering. However, as the actual ordering
makes no difference mathematically and most people are used to thinking about matrices in row-major order,
makes no difference mathematically and most people are used to thinking about matrices in row-major order,
the three.js documentation shows matrices in row-major order. Just bear in mind that if you are reading the source
the three.js documentation shows matrices in row-major order. Just bear in mind that if you are reading the source
code, you'll have to take the transpose of any matrices outlined here to make sense of the calculations.
code, you'll have to take the [link:https://en.wikipedia.org/wiki/Transpose transpose] of any matrices outlined here to make sense of the calculations.
[page:Camera Cameras] have two additional matrix4s:
[page:Camera Cameras] have two additional matrix4s:
<ul>
<ul>
<li>
<li>
[page:Object3D.matrixWorldInverse]: The inverse of the [page:Object3D.matrixWorld] descibed above.
[page:Object3D.matrixWorldInverse]: The inverse of the [page:Object3D.matrixWorld] described above.
</li>
</li>
<li>
<li>
[page:Object3D.projectionMatrix]:
[page:Object3D.projectionMatrix]:
...
@@ -48,13 +48,6 @@
...
@@ -48,13 +48,6 @@
</ul>
</ul>
</div>
</div>
<h2>Example</h2>
<code>
var m = new Matrix4();
</code>
<h2>A Note on Row-Major and Column-Major Ordering</h2>
<h2>A Note on Row-Major and Column-Major Ordering</h2>
<div>
<div>
The [page:set]() method takes arguments in [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order row-major]
The [page:set]() method takes arguments in [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order row-major]
...
@@ -62,21 +55,25 @@ var m = new Matrix4();
...
@@ -62,21 +55,25 @@ var m = new Matrix4();
This means that calling
This means that calling
<code>
<code>
var m = new Matrix4();
m.set( 11, 12, 13, 14,
m.set( 11, 12, 13, 14,
21, 22, 23, 24,
21, 22, 23, 24,
31, 32, 33, 34 );
31, 32, 33, 34,
41, 42, 43, 44 );
</code>
</code>
will result in the [page:.elements elements] array containing:
will result in the [page:.elements elements] array containing:
<code>
<code>
m.elements = [ 11, 21, 31, 41,
m.elements = [ 11, 21, 31, 41,
12, 22, 32, 42,
12, 22, 32, 42,
13, 23, 33, 43 ];
13, 23, 33, 43,
14, 24, 34, 44 ];
</code>
</code>
and internally all calculations are performed using column-major ordering. However, as the actual ordering
and internally all calculations are performed using column-major ordering. However, as the actual ordering
makes no difference mathematically and most people are used to thinking about matrices in row-major order,
makes no difference mathematically and most people are used to thinking about matrices in row-major order,
the three.js documentation shows matrices in row-major order. Just bear in mind that if you are reading the source
the three.js documentation shows matrices in row-major order. Just bear in mind that if you are reading the source
code, you'll have to take the transpose of any matrices outlined here to make sense of the calculations.
code, you'll have to take the [link: https://en.wikipedia.org/wiki/Transpose transpose] of any matrices outlined here to make sense of the calculations.