pub struct Matrix4 {
pub elements: [f64; 16],
}Expand description
Port of three.js’ Matrix4: a 4x4 matrix.
Fields§
§elements: [f64; 16]A column-major list of matrix values.
Implementations§
Source§impl Matrix4
impl Matrix4
Sourcepub fn make_scale(&mut self, x: f64, y: f64, z: f64) -> &mut Self
pub fn make_scale(&mut self, x: f64, y: f64, z: f64) -> &mut Self
Matrix4.makeScale().
Sourcepub fn compose(
&mut self,
position: &Vector3,
quaternion: &Quaternion,
scale: &Vector3,
) -> &mut Self
pub fn compose( &mut self, position: &Vector3, quaternion: &Quaternion, scale: &Vector3, ) -> &mut Self
Matrix4.compose().
Sourcepub fn look_at(
&mut self,
eye: &Vector3,
target: &Vector3,
up: &Vector3,
) -> &mut Self
pub fn look_at( &mut self, eye: &Vector3, target: &Vector3, up: &Vector3, ) -> &mut Self
Matrix4.lookAt(): writes only the upper 3x3 rotation.
Sourcepub fn multiply_matrices(&mut self, a: &Self, b: &Self) -> &mut Self
pub fn multiply_matrices(&mut self, a: &Self, b: &Self) -> &mut Self
Matrix4.multiplyMatrices().
Sourcepub fn make_perspective(
&mut self,
left: f64,
right: f64,
top: f64,
bottom: f64,
near: f64,
far: f64,
coordinate_system: CoordinateSystem,
) -> &mut Self
pub fn make_perspective( &mut self, left: f64, right: f64, top: f64, bottom: f64, near: f64, far: f64, coordinate_system: CoordinateSystem, ) -> &mut Self
Matrix4.makePerspective(), reversedDepth = false.
Sourcepub fn set(
&mut self,
n11: f64,
n12: f64,
n13: f64,
n14: f64,
n21: f64,
n22: f64,
n23: f64,
n24: f64,
n31: f64,
n32: f64,
n33: f64,
n34: f64,
n41: f64,
n42: f64,
n43: f64,
n44: f64,
) -> &mut Self
pub fn set( &mut self, n11: f64, n12: f64, n13: f64, n14: f64, n21: f64, n22: f64, n23: f64, n24: f64, n31: f64, n32: f64, n33: f64, n34: f64, n41: f64, n42: f64, n43: f64, n44: f64, ) -> &mut Self
Matrix4.set( n11, n12, ... ) — row-order arguments into a
column-major store.
Sourcepub fn from_rows(
n11: f64,
n12: f64,
n13: f64,
n14: f64,
n21: f64,
n22: f64,
n23: f64,
n24: f64,
n31: f64,
n32: f64,
n33: f64,
n34: f64,
n41: f64,
n42: f64,
n43: f64,
n44: f64,
) -> Self
pub fn from_rows( n11: f64, n12: f64, n13: f64, n14: f64, n21: f64, n22: f64, n23: f64, n24: f64, n31: f64, n32: f64, n33: f64, n34: f64, n41: f64, n42: f64, n43: f64, n44: f64, ) -> Self
new Matrix4( n11, ... ).
Sourcepub fn set_identity(&mut self) -> &mut Self
pub fn set_identity(&mut self) -> &mut Self
Matrix4.identity().
Sourcepub fn copy_position(&mut self, m: &Self) -> &mut Self
pub fn copy_position(&mut self, m: &Self) -> &mut Self
Matrix4.copyPosition().
Sourcepub fn set_from_matrix3(&mut self, m: &Matrix3) -> &mut Self
pub fn set_from_matrix3(&mut self, m: &Matrix3) -> &mut Self
Matrix4.setFromMatrix3().
Sourcepub fn extract_basis(
&self,
x_axis: &mut Vector3,
y_axis: &mut Vector3,
z_axis: &mut Vector3,
)
pub fn extract_basis( &self, x_axis: &mut Vector3, y_axis: &mut Vector3, z_axis: &mut Vector3, )
Matrix4.extractBasis().
Sourcepub fn make_basis(
&mut self,
x_axis: &Vector3,
y_axis: &Vector3,
z_axis: &Vector3,
) -> &mut Self
pub fn make_basis( &mut self, x_axis: &Vector3, y_axis: &Vector3, z_axis: &Vector3, ) -> &mut Self
Matrix4.makeBasis().
Sourcepub fn extract_rotation(&mut self, m: &Self) -> &mut Self
pub fn extract_rotation(&mut self, m: &Self) -> &mut Self
Matrix4.extractRotation(): the upper 3x3 of m with its scale divided
out. A singular matrix yields the identity.
Sourcepub fn make_rotation_from_euler(&mut self, euler: &Euler) -> &mut Self
pub fn make_rotation_from_euler(&mut self, euler: &Euler) -> &mut Self
Matrix4.makeRotationFromEuler().
Sourcepub fn make_rotation_from_quaternion(&mut self, q: &Quaternion) -> &mut Self
pub fn make_rotation_from_quaternion(&mut self, q: &Quaternion) -> &mut Self
Matrix4.makeRotationFromQuaternion().
Sourcepub fn premultiply(&mut self, m: &Self) -> &mut Self
pub fn premultiply(&mut self, m: &Self) -> &mut Self
Matrix4.premultiply().
Sourcepub fn multiply_scalar(&mut self, s: f64) -> &mut Self
pub fn multiply_scalar(&mut self, s: f64) -> &mut Self
Matrix4.multiplyScalar().
Sourcepub fn determinant(&self) -> f64
pub fn determinant(&self) -> f64
Matrix4.determinant().
Sourcepub fn determinant_affine(&self) -> f64
pub fn determinant_affine(&self) -> f64
Matrix4.determinantAffine() — the determinant of the upper 3x3.
Sourcepub fn set_position(&mut self, x: f64, y: f64, z: f64) -> &mut Self
pub fn set_position(&mut self, x: f64, y: f64, z: f64) -> &mut Self
Matrix4.setPosition().
Sourcepub fn get_max_scale_on_axis(&self) -> f64
pub fn get_max_scale_on_axis(&self) -> f64
Matrix4.getMaxScaleOnAxis().
Sourcepub fn make_translation(&mut self, x: f64, y: f64, z: f64) -> &mut Self
pub fn make_translation(&mut self, x: f64, y: f64, z: f64) -> &mut Self
Matrix4.makeTranslation().
Sourcepub fn make_rotation_x(&mut self, theta: f64) -> &mut Self
pub fn make_rotation_x(&mut self, theta: f64) -> &mut Self
Matrix4.makeRotationX().
Sourcepub fn make_rotation_y(&mut self, theta: f64) -> &mut Self
pub fn make_rotation_y(&mut self, theta: f64) -> &mut Self
Matrix4.makeRotationY().
Sourcepub fn make_rotation_z(&mut self, theta: f64) -> &mut Self
pub fn make_rotation_z(&mut self, theta: f64) -> &mut Self
Matrix4.makeRotationZ().
Sourcepub fn make_rotation_axis(&mut self, axis: &Vector3, angle: f64) -> &mut Self
pub fn make_rotation_axis(&mut self, axis: &Vector3, angle: f64) -> &mut Self
Matrix4.makeRotationAxis(). axis is assumed to be normalized.
Sourcepub fn make_shear(
&mut self,
xy: f64,
xz: f64,
yx: f64,
yz: f64,
zx: f64,
zy: f64,
) -> &mut Self
pub fn make_shear( &mut self, xy: f64, xz: f64, yx: f64, yz: f64, zx: f64, zy: f64, ) -> &mut Self
Matrix4.makeShear().
Sourcepub fn decompose(
&self,
position: &mut Vector3,
quaternion: &mut Quaternion,
scale: &mut Vector3,
)
pub fn decompose( &self, position: &mut Vector3, quaternion: &mut Quaternion, scale: &mut Vector3, )
Matrix4.decompose().
Sourcepub fn make_orthographic(
&mut self,
left: f64,
right: f64,
top: f64,
bottom: f64,
near: f64,
far: f64,
coordinate_system: CoordinateSystem,
) -> &mut Self
pub fn make_orthographic( &mut self, left: f64, right: f64, top: f64, bottom: f64, near: f64, far: f64, coordinate_system: CoordinateSystem, ) -> &mut Self
Matrix4.makeOrthographic(), reversedDepth = false.
Sourcepub fn from_array(&mut self, array: &[f64], offset: usize) -> &mut Self
pub fn from_array(&mut self, array: &[f64], offset: usize) -> &mut Self
Matrix4.fromArray().