import { Matrix4 } from "https://deno.land/x/threejs_4_deno@v121/src/Three.js";
A 4x4 Matrix.
Examples
// Simple rig for rotating around 3 axes
const m = new THREE.Matrix4();
const m1 = new THREE.Matrix4();
const m2 = new THREE.Matrix4();
const m3 = new THREE.Matrix4();
const alpha = 0;
const beta = Math.PI;
const gamma = Math.PI/2;
m1.makeRotationX( alpha );
m2.makeRotationY( beta );
m3.makeRotationZ( gamma );
m.multiplyMatrices( m1, m2 );
m.multiply( m3 );
// Simple rig for rotating around 3 axes const m = new THREE.Matrix4(); const m1 = new THREE.Matrix4(); const m2 = new THREE.Matrix4(); const m3 = new THREE.Matrix4(); const alpha = 0; const beta = Math.PI; const gamma = Math.PI/2; m1.makeRotationX( alpha ); m2.makeRotationY( beta ); m3.makeRotationZ( gamma ); m.multiplyMatrices( m1, m2 ); m.multiply( m3 );
Methods
Sets this matrix to the transformation composed of translation, rotation and scale.
Computes determinant of this matrix. Based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
Copies the rotation component of the supplied matrix m into this matrix rotation component.
Sets the values of this matrix from the provided array.
Sets the values of this matrix from the provided array-like.
Sets this matrix to the inverse of matrix m. Based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm.
Constructs a rotation matrix, looking from eye towards center with defined up vector.
Creates an orthographic projection matrix.
Creates a frustum matrix.
Creates a perspective projection matrix.
Sets this matrix as rotation transform around axis by angle radians. Based on http://www.gamedev.net/reference/articles/article1199.asp.
Sets this matrix as rotation transform around x axis by theta radians.
Sets this matrix as rotation transform around y axis by theta radians.
Sets this matrix as rotation transform around z axis by theta radians.
Sets this matrix as translation transform.
Sets this matrix to a x b.
Multiplies this matrix by s.
Sets this matrix to a x b and stores the result into the flat array r. r can be either a regular Array or a TypedArray.
Sets all fields of this matrix.
Sets the position component for this matrix from vector v.
Returns an array with the values of this matrix, or copies them into the provided array.
Copies he values of this matrix into the provided array-like.