Struct vox_geometry_rust::matrix4x4::Matrix4x4[][src]

pub struct Matrix4x4<T: Float> { /* fields omitted */ }
Expand description

4-D matrix class.

This class is a row-major 4-D matrix class, which means each element of the matrix is stored in order of (0,0), … , (0,3), (1,0), … , (3,3). Also, this 4-D matrix is specialized for geometric transformations.

  • tparam T - Type of the element.

Implementations

impl<T: Float> Matrix4x4<T>[src]

pub fn new_default() -> Matrix4x4<T>[src]

Constructs identity matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new_default();
assert_eq!(mat == Matrix4x4D::new(1.0, 0.0, 0.0, 0.0,
                                0.0, 1.0, 0.0, 0.0,
                                0.0, 0.0, 1.0, 0.0,
                                0.0, 0.0, 0.0, 1.0), true);

pub fn new_scalar(s: T) -> Matrix4x4<T>[src]

Constructs constant value matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat2 = Matrix4x4D::new_scalar(3.1);
for i in 0..16 {
    assert_eq!(3.1, mat2[i]);
}

pub fn new(
    m00: T,
    m01: T,
    m02: T,
    m03: T,
    m10: T,
    m11: T,
    m12: T,
    m13: T,
    m20: T,
    m21: T,
    m22: T,
    m23: T,
    m30: T,
    m31: T,
    m32: T,
    m33: T
) -> Matrix4x4<T>
[src]

Constructs a matrix with input elements. \warning Ordering of the input elements is row-major.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat3 = Matrix4x4D::new(1.0, 2.0, 3.0, 4.0,
                            5.0, 6.0, 7.0, 8.0,
                            9.0, 10.0, 11.0, 12.0,
                            13.0, 14.0, 15.0, 16.0);
for i in 0..16 {
    assert_eq!((i+1) as f64, mat3[i]);
}

pub fn new_lst(lst: [[T; 4]; 4]) -> Matrix4x4<T>[src]

Constructs a matrix with given initializer list lst.

This constructor will build a matrix with given initializer list lst such as

use vox_geometry_rust::matrix4x4::Matrix4x4F;
let arr = Matrix4x4F::new_lst(
                            [[1.0, 2.0, 3.0, 4.0],
                            [5.0, 6.0, 7.0, 8.0],
                            [9.0, 10.0, 11.0, 12.0],
                            [13.0, 14.0, 15.0, 16.0]]);

Note the initializer also has 2x2 structure.

  • parameter: lst Initializer list that should be copy to the new matrix.
use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat4 = Matrix4x4D::new_lst([[1.0, 2.0, 3.0, 4.0],
                            [5.0, 6.0, 7.0, 8.0],
                            [9.0, 10.0, 11.0, 12.0],
                            [13.0, 14.0, 15.0, 16.0]]);
for i in 0..16 {
    assert_eq!((i + 1) as f64, mat4[i]);
}

pub fn new_mat(m33: Matrix3x3<T>) -> Matrix4x4<T>[src]

Constructs a matrix with 3x3 matrix. This constructor initialize 3x3 part, and other parts are set to 0 except (3,3) which is set to 1.

pub fn new_array(arr: [T; 16]) -> Matrix4x4<T>[src]

Constructs a matrix with input array. \warning Ordering of the input elements is row-major.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let arr = [1.0, 2.0, 3.0, 4.0,
        5.0, 6.0, 7.0, 8.0,
        9.0, 10.0, 11.0, 12.0,
        13.0, 14.0, 15.0, 16.0];
let mat6 = Matrix4x4D::new_array(arr);
for i in 0..16 {
    assert_eq!((i + 1) as f64, mat6[i]);
}

impl<T: Float> Matrix4x4<T>[src]

pub fn set_scalar(&mut self, s: T)[src]

Sets whole matrix with input scalar.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new_default();

mat.set_scalar(3.1);
for i in 0..16 {
    assert_eq!(3.1, mat[i]);
}

pub fn set(
    &mut self,
    m00: T,
    m01: T,
    m02: T,
    m03: T,
    m10: T,
    m11: T,
    m12: T,
    m13: T,
    m20: T,
    m21: T,
    m22: T,
    m23: T,
    m30: T,
    m31: T,
    m32: T,
    m33: T
)
[src]

Sets this matrix with input elements. \warning Ordering of the input elements is row-major.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new_default();

mat.set(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0);
for i in 0..16 {
    assert_eq!((i + 1) as f64, mat[i]);
}

pub fn set_lst(&mut self, lst: [[T; 4]; 4])[src]

\brief Sets this matrix with given initializer list lst.

This function will fill the matrix with given initializer list lst such as

use vox_geometry_rust::matrix3x3::Matrix3x3F;
let mut arr =  Matrix3x3F::new_default();
arr.set_lst([
    [1.0, 2.0, 3.0],
    [9.0, 3.0, 4.0],
    [5.0, 6.0, 2.0]
]);

Note the initializer also has 2x2 structure.

  • parameter: lst Initializer list that should be copy to the matrix.
use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new_default();
mat.set_lst([[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0], [9.0, 10.0, 11.0, 12.0], [13.0, 14.0, 15.0, 16.0]]);
for i in 0..16 {
    assert_eq!((i + 1) as f64, mat[i]);
}

pub fn set_mat(&mut self, m33: Matrix3x3<T>)[src]

Sets this matrix with input 3x3 matrix. This method copies 3x3 part only, and other parts are set to 0 except (3,3) which will be set to 1.

pub fn set_self(&mut self, m: Matrix4x4<T>)[src]

Copies from input matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new_default();
mat.set_self(Matrix4x4D::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0));
for i in 0..16 {
    assert_eq!((i + 1) as f64, mat[i]);
}

pub fn set_array(&mut self, arr: [T; 16])[src]

Copies from input array. warning Ordering of the input elements is row-major.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new_default();
let arr = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0];
mat.set_array(arr);
for i in 0..16 {
    assert_eq!((i + 1) as f64, mat[i]);
}

pub fn set_diagonal(&mut self, s: T)[src]

Sets diagonal elements with input scalar.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new_default();
mat.set_diagonal(3.1);
for i in 0..4 {
    for j in 0..4 {
        if i == j {
            assert_eq!(3.1, mat[(i, j)]);
        } else {
            assert_eq!(0.0, mat[(i, j)]);
        }
    }
}

pub fn set_off_diagonal(&mut self, s: T)[src]

Sets off-diagonal elements with input scalar.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new_scalar(0.0);
mat.set_off_diagonal(4.2);
for i in 0..4 {
    for j in 0..4 {
        if i != j {
            assert_eq!(4.2, mat[(i, j)]);
        } else {
            assert_eq!(0.0, mat[(i, j)]);
        }
    }
}

pub fn set_row(&mut self, i: usize, row: Vector4<T>)[src]

Sets i-th row with input vector.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
use vox_geometry_rust::vector4::Vector4D;
let mut mat = Matrix4x4D::new_default();
mat.set_row(0, Vector4D::new(1.0, 2.0, 3.0, 4.0));
mat.set_row(1, Vector4D::new(5.0, 6.0, 7.0, 8.0));
mat.set_row(2, Vector4D::new(9.0, 10.0, 11.0, 12.0));
mat.set_row(3, Vector4D::new(13.0, 14.0, 15.0, 16.0));
for i in 0..16 {
     assert_eq!((i + 1) as f64, mat[i]);
}

pub fn set_column(&mut self, j: usize, col: Vector4<T>)[src]

Sets i-th column with input vector.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
use vox_geometry_rust::vector4::Vector4D;
let mut mat = Matrix4x4D::new_default();
mat.set_column(0, Vector4D::new(1.0, 5.0, 9.0, 13.0));
mat.set_column(1, Vector4D::new(2.0, 6.0, 10.0, 14.0));
mat.set_column(2, Vector4D::new(3.0, 7.0, 11.0, 15.0));
mat.set_column(3, Vector4D::new(4.0, 8.0, 12.0, 16.0));
 for i in 0..16 {
    assert_eq!((i + 1) as f64, mat[i]);
}

impl<T: Float> Matrix4x4<T>[src]

pub fn is_similar(&self, m: Matrix4x4<T>, tol: Option<T>) -> bool[src]

Returns true if this matrix is similar to the input matrix within the given tolerance.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0);
let mat2 = Matrix4x4D::new(1.01, 2.01, 2.99, 4.0, 4.99, 6.001, 7.0003, 8.0, 8.99,
                    10.01, 11.0, 11.99, 13.01, 14.001, 14.999, 16.0);

assert_eq!(mat.is_similar(mat2, Some(0.02)), true);
assert_eq!(mat.is_similar(mat2, Some(0.001)), false);

pub fn is_square(&self) -> bool[src]

Returns true if this matrix is a square matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0);
assert_eq!(mat.is_square(), true);

pub fn rows(&self) -> usize[src]

Returns number of rows of this matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0);
assert_eq!(mat.rows(), 4);

pub fn cols(&self) -> usize[src]

Returns number of columns of this matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0);
assert_eq!(mat.cols(), 4);

pub fn data_mut(&mut self) -> &mut [T; 16][src]

Returns data pointer of this matrix.

pub fn data(&self) -> &[T; 16][src]

Returns constant pointer of this matrix.

pub fn matrix3(&self) -> Matrix3x3<T>[src]

Returns 3x3 part of this matrix.

impl<T: Float> Matrix4x4<T>[src]

pub fn add_scalar(&self, s: T) -> Matrix4x4<T>[src]

Returns this matrix + input scalar.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                         -12.0, 11.0, -10.0, 9.0,
                         -8.0, 7.0, -6.0, 5.0,
                         -6.0, 3.0, -2.0, 1.0);
let mat2 = mat.add_scalar(2.0);
assert_eq!(mat2.is_similar(Matrix4x4D::new_lst([[-14.0, 17.0, -12.0, 15.0],
                                                [-10.0, 13.0, -8.0, 11.0],
                                                [-6.0, 9.0, -4.0, 7.0],
                                                [-4.0, 5.0, 0.0, 3.0]]), None), true);

pub fn add_mat(&self, m: Matrix4x4<T>) -> Matrix4x4<T>[src]

Returns this matrix + input matrix (element-wise).

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                         -12.0, 11.0, -10.0, 9.0,
                         -8.0, 7.0, -6.0, 5.0,
                         -6.0, 3.0, -2.0, 1.0);
let mat2 = mat.add_mat(Matrix4x4D::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0));
assert_eq!(mat2.is_similar(Matrix4x4D::new_lst([[-15.0, 17.0, -11.0, 17.0],
                                                [-7.0, 17.0, -3.0, 17.0],
                                                [1.0, 17.0, 5.0, 17.0],
                                                [7.0, 17.0, 13.0, 17.0]]), None), true);

pub fn sub_scalar(&self, s: T) -> Matrix4x4<T>[src]

Returns this matrix - input scalar.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                         -12.0, 11.0, -10.0, 9.0,
                         -8.0, 7.0, -6.0, 5.0,
                         -6.0, 3.0, -2.0, 1.0);
let mat2 = mat.sub_scalar(2.0);
assert_eq!(mat2.is_similar(Matrix4x4D::new_lst([[-18.0, 13.0, -16.0, 11.0],
                                                [-14.0, 9.0, -12.0, 7.0],
                                                [-10.0, 5.0, -8.0, 3.0],
                                                [-8.0, 1.0, -4.0, -1.0]]), None), true);

pub fn sub_mat(&self, m: Matrix4x4<T>) -> Matrix4x4<T>[src]

Returns this matrix - input matrix (element-wise).

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                         -12.0, 11.0, -10.0, 9.0,
                         -8.0, 7.0, -6.0, 5.0,
                         -6.0, 3.0, -2.0, 1.0);
let mat2 = mat.sub_mat(Matrix4x4D::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0));
assert_eq!(mat2.is_similar(Matrix4x4D::new_lst([[-17.0, 13.0, -17.0, 9.0],
                                                [-17.0, 5.0, -17.0, 1.0],
                                                [-17.0, -3.0, -17.0, -7.0],
                                                [-19.0, -11.0, -17.0, -15.0]]), None), true);

pub fn mul_scalar(&self, s: T) -> Matrix4x4<T>[src]

Returns this matrix * input scalar.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                         -12.0, 11.0, -10.0, 9.0,
                         -8.0, 7.0, -6.0, 5.0,
                         -6.0, 3.0, -2.0, 1.0);
let mat2 = mat.mul_scalar(2.0);
assert_eq!(mat2.is_similar(Matrix4x4D::new_lst([[-32.0, 30.0, -28.0, 26.0],
                                                [-24.0, 22.0, -20.0, 18.0],
                                                [-16.0, 14.0, -12.0, 10.0],
                                                [-12.0, 6.0, -4.0, 2.0]]), None), true);

pub fn mul_vec(&self, v: Vector4<T>) -> Vector4<T>[src]

Returns this matrix * input vector.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
use vox_geometry_rust::vector4::Vector4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                         -12.0, 11.0, -10.0, 9.0,
                         -8.0, 7.0, -6.0, 5.0,
                         -6.0, 3.0, -2.0, 1.0);
let vec = mat.mul_vec(Vector4D::new(1.0, 2.0, 3.0, 4.0));
assert_eq!(vec.is_similar(&Vector4D::new(24.0, 16.0, 8.0, -2.0), None), true);

pub fn mul_mat(&self, m: Matrix4x4<T>) -> Matrix4x4<T>[src]

Returns this matrix * input matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                         -12.0, 11.0, -10.0, 9.0,
                         -8.0, 7.0, -6.0, 5.0,
                         -6.0, 3.0, -2.0, 1.0);
let mat2 = mat.mul_mat(Matrix4x4D::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0));
assert_eq!(mat2.is_similar(Matrix4x4D::new_lst([[102.0, 100.0, 98.0, 96.0],
                                                [70.0, 68.0, 66.0, 64.0],
                                                [38.0, 36.0, 34.0, 32.0],
                                                [4.0, 0.0, -4.0, -8.0]]), None), true);

pub fn div_scalar(&self, s: T) -> Matrix4x4<T>[src]

Returns this matrix / input scalar.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                         -12.0, 11.0, -10.0, 9.0,
                         -8.0, 7.0, -6.0, 5.0,
                         -6.0, 3.0, -2.0, 1.0);
let mat2 = mat.div_scalar(2.0);
assert_eq!(mat2.is_similar(Matrix4x4D::new_lst([[-8.0, 15.0/2.0, -7.0, 13.0/2.0],
                                                [-6.0, 11.0/2.0, -5.0, 9.0/2.0],
                                                [-4.0, 7.0/2.0, -3.0, 5.0/2.0],
                                                [-3.0, 3.0/2.0, -1.0, 1.0/2.0]]), None), true);

impl<T: Float> Matrix4x4<T>[src]

pub fn radd_scalar(&self, s: T) -> Matrix4x4<T>[src]

Returns input scalar + this matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                         -12.0, 11.0, -10.0, 9.0,
                         -8.0, 7.0, -6.0, 5.0,
                         -6.0, 3.0, -2.0, 1.0);
let mat2 = mat.radd_scalar(2.0);
assert_eq!(mat2.is_similar(Matrix4x4D::new_lst([[-14.0, 17.0, -12.0, 15.0],
                                                [-10.0, 13.0, -8.0, 11.0],
                                                [-6.0, 9.0, -4.0, 7.0],
                                                [-4.0, 5.0, 0.0, 3.0]]), None), true);

pub fn radd_mat(&self, m: Matrix4x4<T>) -> Matrix4x4<T>[src]

Returns input matrix + this matrix (element-wise).

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                         -12.0, 11.0, -10.0, 9.0,
                         -8.0, 7.0, -6.0, 5.0,
                         -6.0, 3.0, -2.0, 1.0);
let mat2 = mat.radd_mat(Matrix4x4D::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0));
assert_eq!(mat2.is_similar(Matrix4x4D::new_lst([[-15.0, 17.0, -11.0, 17.0],
                                                [-7.0, 17.0, -3.0, 17.0],
                                                [1.0, 17.0, 5.0, 17.0],
                                                [7.0, 17.0, 13.0, 17.0]]), None), true);

pub fn rsub_scalar(&self, s: T) -> Matrix4x4<T>[src]

Returns input scalar - this matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                         -12.0, 11.0, -10.0, 9.0,
                         -8.0, 7.0, -6.0, 5.0,
                         -6.0, 3.0, -2.0, 1.0);
let mat2 = mat.rsub_scalar(2.0);
assert_eq!(mat2.is_similar(Matrix4x4D::new_lst([[18.0, -13.0, 16.0, -11.0],
                                                [14.0, -9.0, 12.0, -7.0],
                                                [10.0, -5.0, 8.0, -3.0],
                                                [8.0, -1.0, 4.0, 1.0]]), None), true);

pub fn rsub_mat(&self, m: Matrix4x4<T>) -> Matrix4x4<T>[src]

Returns input matrix - this matrix (element-wise).

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                         -12.0, 11.0, -10.0, 9.0,
                         -8.0, 7.0, -6.0, 5.0,
                         -6.0, 3.0, -2.0, 1.0);
let mat2 = mat.rsub_mat(Matrix4x4D::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0));
assert_eq!(mat2.is_similar(Matrix4x4D::new_lst([[17.0, -13.0, 17.0, -9.0],
                                                [17.0, -5.0, 17.0, -1.0],
                                                [17.0, 3.0, 17.0, 7.0],
                                                [19.0, 11.0, 17.0, 15.0]]), None), true);

pub fn rmul_scalar(&self, s: T) -> Matrix4x4<T>[src]

Returns input scalar * this matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                         -12.0, 11.0, -10.0, 9.0,
                         -8.0, 7.0, -6.0, 5.0,
                         -6.0, 3.0, -2.0, 1.0);
let mat2 = mat.rmul_scalar(2.0);
assert_eq!(mat2.is_similar(Matrix4x4D::new_lst([[-32.0, 30.0, -28.0, 26.0],
                                                [-24.0, 22.0, -20.0, 18.0],
                                                [-16.0, 14.0, -12.0, 10.0],
                                                [-12.0, 6.0, -4.0, 2.0]]), None), true);

pub fn rmul_mat(&self, m: Matrix4x4<T>) -> Matrix4x4<T>[src]

Returns input matrix * this matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                         -12.0, 11.0, -10.0, 9.0,
                         -8.0, 7.0, -6.0, 5.0,
                         -6.0, 3.0, -2.0, 1.0);
let mat2 = mat.rmul_mat(Matrix4x4D::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0));
assert_eq!(mat2.is_similar(Matrix4x4D::new_lst([[-88.0, 70.0, -60.0, 50.0],
                                                [-256.0, 214.0, -188.0, 162.0],
                                                [-424.0, 358.0, -316.0, 274.0],
                                                [-592.0, 502.0, -444.0, 386.0]]), None), true);

pub fn rdiv_scalar(&self, s: T) -> Matrix4x4<T>[src]

Returns input scalar / this matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                         -12.0, 11.0, -10.0, 9.0,
                         -8.0, 7.0, -6.0, 5.0,
                         -6.0, 3.0, -2.0, 1.0);
let mat2 = mat.rdiv_scalar(2.0);
assert_eq!(mat2.is_similar(Matrix4x4D::new_lst([[-1.0/8.0, 2.0/15.0, -1.0/7.0, 2.0/13.0],
                                                [-1.0/6.0, 2.0/11.0, -1.0/5.0, 2.0/9.0],
                                                [-1.0/4.0, 2.0/7.0, -1.0/3.0, 2.0/5.0],
                                                [-1.0/3.0, 2.0/3.0, -1.0, 2.0]]), None), true);

impl<T: Float> Matrix4x4<T>[src]

pub fn iadd_scalar(&mut self, s: T)[src]

Adds input scalar to this matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -6.0, 3.0, -2.0, 1.0);
mat.iadd_scalar(2.0);
assert_eq!(mat.is_similar(Matrix4x4D::new_lst([[-14.0, 17.0, -12.0, 15.0],
                                                [-10.0, 13.0, -8.0, 11.0],
                                                [-6.0, 9.0, -4.0, 7.0],
                                                [-4.0, 5.0, 0.0, 3.0]]), None), true);

pub fn iadd_mat(&mut self, m: Matrix4x4<T>)[src]

Adds input matrix to this matrix (element-wise).

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -6.0, 3.0, -2.0, 1.0);
mat.iadd_mat(Matrix4x4D::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0));
assert_eq!(mat.is_similar(Matrix4x4D::new_lst([[-15.0, 17.0, -11.0, 17.0],
                                                [-7.0, 17.0, -3.0, 17.0],
                                                [1.0, 17.0, 5.0, 17.0],
                                                [7.0, 17.0, 13.0, 17.0]]), None), true);

pub fn isub_scalar(&mut self, s: T)[src]

Subtracts input scalar from this matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -6.0, 3.0, -2.0, 1.0);
mat.isub_scalar(2.0);
assert_eq!(mat.is_similar(Matrix4x4D::new_lst([[-18.0, 13.0, -16.0, 11.0],
                                                [-14.0, 9.0, -12.0, 7.0],
                                                [-10.0, 5.0, -8.0, 3.0],
                                                [-8.0, 1.0, -4.0, -1.0]]), None), true);

pub fn isub_mat(&mut self, m: Matrix4x4<T>)[src]

Subtracts input matrix from this matrix (element-wise).

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -6.0, 3.0, -2.0, 1.0);
mat.isub_mat(Matrix4x4D::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0));
assert_eq!(mat.is_similar(Matrix4x4D::new_lst([[-17.0, 13.0, -17.0, 9.0],
                                                [-17.0, 5.0, -17.0, 1.0],
                                                [-17.0, -3.0, -17.0, -7.0],
                                                [-19.0, -11.0, -17.0, -15.0]]), None), true);

pub fn imul_scalar(&mut self, s: T)[src]

Multiplies input scalar to this matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -6.0, 3.0, -2.0, 1.0);
mat.imul_scalar(2.0);
assert_eq!(mat.is_similar(Matrix4x4D::new_lst([[-32.0, 30.0, -28.0, 26.0],
                                                [-24.0, 22.0, -20.0, 18.0],
                                                [-16.0, 14.0, -12.0, 10.0],
                                                [-12.0, 6.0, -4.0, 2.0]]), None), true);

pub fn imul_mat(&mut self, m: Matrix4x4<T>)[src]

Multiplies input matrix to this matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -6.0, 3.0, -2.0, 1.0);
mat.imul_mat(Matrix4x4D::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0));
assert_eq!(mat.is_similar(Matrix4x4D::new_lst([[102.0, 100.0, 98.0, 96.0],
                                                [70.0, 68.0, 66.0, 64.0],
                                                [38.0, 36.0, 34.0, 32.0],
                                                [4.0, 0.0, -4.0, -8.0]]), None), true);

pub fn idiv_scalar(&mut self, s: T)[src]

Divides this matrix with input scalar.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -6.0, 3.0, -2.0, 1.0);
mat.idiv_scalar(2.0);
assert_eq!(mat.is_similar(Matrix4x4D::new_lst([[-8.0, 15.0/2.0, -7.0, 13.0/2.0],
                                                [-6.0, 11.0/2.0, -5.0, 9.0/2.0],
                                                [-4.0, 7.0/2.0, -3.0, 5.0/2.0],
                                                [-3.0, 3.0/2.0, -1.0, 1.0/2.0]]), None), true);

impl<T: Float> Matrix4x4<T>[src]

pub fn transpose(&mut self)[src]

Transposes this matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -6.0, 3.0, -2.0, 1.0);

mat.transpose();
assert_eq!(mat.is_similar(Matrix4x4D::new_lst([[-16.0, -12.0, -8.0, -6.0],
                                                [15.0, 11.0, 7.0, 3.0],
                                                [-14.0, -10.0, -6.0, -2.0],
                                                [13.0, 9.0, 5.0, 1.0]]), None), true);

pub fn invert(&mut self)[src]

Inverts this matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 6.0,
                            -6.0, 3.0, -2.0, 2.0);

mat.invert();
assert_eq!(mat.is_similar(Matrix4x4D::new_lst([[-1.0/2.0, 1.0/2.0, 1.0/2.0, -1.0/2.0],
                                                [-5.0/2.0, 5.0/2.0, 2.0, -1.0],
                                                [-5.0/4.0, 1.0/4.0, 5.0/2.0, -1.0/2.0],
                                                [1.0, -2.0, 1.0, 0.0]]), None), true);

impl<T: Float> Matrix4x4<T>[src]

pub fn sum(&self) -> T[src]

Returns sum of all elements.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -4.0, 3.0, -2.0, 1.0);

assert_eq!(-8.0, mat.sum());

pub fn avg(&self) -> T[src]

Returns average of all elements.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -4.0, 3.0, -2.0, 1.0);

assert_eq!(-0.5, mat.avg());

pub fn min(&self) -> T[src]

Returns minimum among all elements.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -4.0, 3.0, -2.0, 1.0);

assert_eq!(-16.0, mat.min());

pub fn max(&self) -> T[src]

Returns maximum among all elements.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -4.0, 3.0, -2.0, 1.0);

assert_eq!(15.0, mat.max());

pub fn absmin(&self) -> T[src]

Returns absolute minimum among all elements.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -4.0, 3.0, -2.0, 1.0);

assert_eq!(1.0, mat.absmin());

pub fn absmax(&self) -> T[src]

Returns absolute maximum among all elements.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -4.0, 3.0, -2.0, 1.0);

assert_eq!(-16.0, mat.absmax());

pub fn trace(&self) -> T[src]

Returns sum of all diagonal elements.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -4.0, 3.0, -2.0, 1.0);

assert_eq!(-10.0, mat.trace());

pub fn determinant(&self) -> T[src]

Returns determinant of this matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -4.0, 3.0, -2.0, 1.0);

assert_eq!(0.0, mat.determinant());

pub fn diagonal(&self) -> Matrix4x4<T>[src]

Returns diagonal part of this matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -4.0, 3.0, -2.0, 1.0);

let mat2 = mat.diagonal();
assert_eq!(mat2.is_similar(Matrix4x4D::new(-16.0, 0.0, 0.0, 0.0, 0.0, 11.0, 0.0, 0.0, 0.0, 0.0, -6.0, 0.0, 0.0, 0.0, 0.0, 1.0), None), true);

pub fn off_diagonal(&self) -> Matrix4x4<T>[src]

Returns off-diagonal part of this matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -4.0, 3.0, -2.0, 1.0);

let mat2 = mat.off_diagonal();
assert_eq!(mat2.is_similar(Matrix4x4D::new(0.0, 15.0, -14.0, 13.0, -12.0, 0.0, -10.0, 9.0, -8.0, 7.0, 0.0, 5.0, -4.0, 3.0, -2.0, 0.0), None), true);

pub fn strict_lower_tri(&self) -> Matrix4x4<T>[src]

Returns strictly lower triangle part of this matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -4.0, 3.0, -2.0, 1.0);

let mat2 = mat.strict_lower_tri();
assert_eq!(mat2.is_similar(Matrix4x4D::new(0.0, 0.0, 0.0, 0.0,
                                        -12.0, 0.0, 0.0, 0.0,
                                        -8.0, 7.0, 0.0, 0.0,
                                        -4.0, 3.0, -2.0, 0.0), None), true);

pub fn strict_upper_tri(&self) -> Matrix4x4<T>[src]

Returns strictly upper triangle part of this matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -4.0, 3.0, -2.0, 1.0);

let mat2 = mat.strict_upper_tri();
assert_eq!(mat2.is_similar(Matrix4x4D::new(0.0, 15.0, -14.0, 13.0,
                                        0.0, 0.0, -10.0, 9.0,
                                        0.0, 0.0, 0.0, 5.0,
                                        0.0, 0.0, 0.0, 0.0), None), true);

pub fn lower_tri(&self) -> Matrix4x4<T>[src]

Returns lower triangle part of this matrix (including the diagonal).

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -4.0, 3.0, -2.0, 1.0);

let mat2 = mat.lower_tri();
assert_eq!(mat2.is_similar(Matrix4x4D::new(-16.0, 0.0, 0.0, 0.0,
                                        -12.0, 11.0, 0.0, 0.0,
                                        -8.0, 7.0, -6.0, 0.0,
                                        -4.0, 3.0, -2.0, 1.0), None), true);

pub fn upper_tri(&self) -> Matrix4x4<T>[src]

Returns upper triangle part of this matrix (including the diagonal).

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -4.0, 3.0, -2.0, 1.0);

let mat2 = mat.upper_tri();
assert_eq!(mat2.is_similar(Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                                        0.0, 11.0, -10.0, 9.0,
                                        0.0, 0.0, -6.0, 5.0,
                                        0.0, 0.0, 0.0, 1.0), None), true);

pub fn transposed(&self) -> Matrix4x4<T>[src]

Returns transposed matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -4.0, 3.0, -2.0, 1.0);

let mat2 = mat.transposed();
assert_eq!(mat2.is_similar(Matrix4x4D::new_lst([[-16.0, -12.0, -8.0, -4.0],
                                                [15.0, 11.0, 7.0, 3.0],
                                                [-14.0, -10.0, -6.0, -2.0],
                                                [13.0, 9.0, 5.0, 1.0]]), None), true);

pub fn inverse(&self) -> Matrix4x4<T>[src]

Returns inverse matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 6.0,
                            -6.0, 3.0, -2.0, 2.0);

let mat2 = mat.inverse();
assert_eq!(mat2.is_similar(Matrix4x4D::new_lst([[-1.0/2.0, 1.0/2.0, 1.0/2.0, -1.0/2.0],
                                                [-5.0/2.0, 5.0/2.0, 2.0, -1.0],
                                                [-5.0/4.0, 1.0/4.0, 5.0/2.0, -1.0/2.0],
                                                [1.0, -2.0, 1.0, 0.0]]), None), true);

impl<T: Float> Matrix4x4<T>[src]

pub fn make_zero() -> Matrix4x4<T>[src]

Sets all matrix entries to zero.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::make_zero();
for i in 0..16 {
    assert_eq!(0.0, mat[i]);
}

pub fn make_identity() -> Matrix4x4<T>[src]

Makes all diagonal elements to 1, and other elements to 0.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::make_identity();
for i in 0..4 {
    for j in 0..4 {
        if i == j {
            assert_eq!(1.0, mat[(i, j)]);
        } else {
            assert_eq!(0.0, mat[(i, j)]);
        }
    }
}

pub fn make_scale_matrix_scalar(sx: T, sy: T, sz: T) -> Matrix4x4<T>[src]

Makes scale matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::make_scale_matrix_scalar(3.0, -4.0, 2.4);
assert_eq!(mat.is_similar(Matrix4x4D::new(3.0, 0.0, 0.0, 0.0,
                                        0.0, -4.0, 0.0, 0.0,
                                        0.0, 0.0, 2.4, 0.0,
                                        0.0, 0.0, 0.0, 1.0), None), true);

pub fn make_scale_matrix_vec(s: Vector3<T>) -> Matrix4x4<T>[src]

Makes scale matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
use vox_geometry_rust::vector3::Vector3D;
let mat = Matrix4x4D::make_scale_matrix_vec(Vector3D::new(-2.0, 5.0, 3.5));
assert_eq!(mat.is_similar(Matrix4x4D::new(-2.0, 0.0, 0.0, 0.0,
                                        0.0, 5.0, 0.0, 0.0,
                                        0.0, 0.0, 3.5, 0.0,
                                        0.0, 0.0, 0.0, 1.0), None), true);

pub fn make_rotation_matrix(axis: Vector3<T>, rad: T) -> Matrix4x4<T>[src]

Makes rotation matrix. warning Input angle should be radian.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
use vox_geometry_rust::vector3::Vector3D;
use vox_geometry_rust::constants::K_PI_D;
let mat = Matrix4x4D::make_rotation_matrix(Vector3D::new(-1.0/3.0, 2.0/3.0, 2.0/3.0), -74.0 / 180.0 * K_PI_D);
assert_eq!(mat.is_similar(Matrix4x4D::new(
        0.36, 0.48, -0.8, 0.0,
        -0.8, 0.60, 0.0, 0.0,
        0.48, 0.64, 0.6, 0.0,
        0.0, 0.0, 0.0, 1.0), Some(0.05)), true);

pub fn make_translation_matrix(t: Vector3<T>) -> Matrix4x4<T>[src]

Makes translation matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
use vox_geometry_rust::vector3::Vector3D;
let mat = Matrix4x4D::make_translation_matrix(Vector3D::new(-2.0, 5.0, 3.5));
assert_eq!(mat.is_similar(Matrix4x4D::new(1.0, 0.0, 0.0, -2.0,
                                        0.0, 1.0, 0.0, 5.0,
                                        0.0, 0.0, 1.0, 3.5,
                                        0.0, 0.0, 0.0, 1.0), None), true);

Trait Implementations

impl<T: Float> Add<Matrix4x4<T>> for Matrix4x4<T>[src]

Returns a + b (element-size).

type Output = Matrix4x4<T>

The resulting type after applying the + operator.

fn add(self, rhs: Self) -> Self::Output[src]

Performs the + operation. Read more

impl<T: Float> Add<T> for Matrix4x4<T>[src]

Returns a + b’, where every element of matrix b’ is b.

type Output = Matrix4x4<T>

The resulting type after applying the + operator.

fn add(self, rhs: T) -> Self::Output[src]

Performs the + operation. Read more

impl<T: Float> AddAssign<Matrix4x4<T>> for Matrix4x4<T>[src]

Addition assignment with input matrix (element-wise).

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -6.0, 3.0, -2.0, 1.0);

mat += Matrix4x4D::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0);
assert_eq!(mat.is_similar(Matrix4x4D::new_lst([[-15.0, 17.0, -11.0, 17.0],
                                                [-7.0, 17.0, -3.0, 17.0],
                                                [1.0, 17.0, 5.0, 17.0],
                                                [7.0, 17.0, 13.0, 17.0]]), None), true);

fn add_assign(&mut self, rhs: Self)[src]

Performs the += operation. Read more

impl<T: Float> AddAssign<T> for Matrix4x4<T>[src]

Addition assignment with input scalar.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -6.0, 3.0, -2.0, 1.0);

mat += 2.0;
assert_eq!(mat.is_similar(Matrix4x4D::new_lst([[-14.0, 17.0, -12.0, 15.0],
                                                [-10.0, 13.0, -8.0, 11.0],
                                                [-6.0, 9.0, -4.0, 7.0],
                                                [-4.0, 5.0, 0.0, 3.0]]), None), true);

fn add_assign(&mut self, rhs: T)[src]

Performs the += operation. Read more

impl<T: Float> Clone for Matrix4x4<T>[src]

Setter operators

Copy constructor.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat4 = Matrix4x4D::new_lst([[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0], [9.0, 10.0, 11.0, 12.0], [13.0, 14.0, 15.0, 16.0]]);
let mat5 = mat4;
for i in 0..16 {
    assert_eq!((i + 1) as f64, mat5[i]);
}

fn clone(&self) -> Self[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T: Float> Div<T> for Matrix4x4<T>[src]

Returns a’ / b, where every element of matrix a’ is a.

type Output = Matrix4x4<T>

The resulting type after applying the / operator.

fn div(self, rhs: T) -> Self::Output[src]

Performs the / operation. Read more

impl<T: Float> DivAssign<T> for Matrix4x4<T>[src]

Division assignment with input scalar.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -6.0, 3.0, -2.0, 1.0);

mat /= 2.0;
assert_eq!(mat.is_similar(Matrix4x4D::new_lst([[-8.0, 15.0/2.0, -7.0, 13.0/2.0],
                                                [-6.0, 11.0/2.0, -5.0, 9.0/2.0],
                                                [-4.0, 7.0/2.0, -3.0, 5.0/2.0],
                                                [-3.0, 3.0/2.0, -1.0, 1.0/2.0]]), None), true);

fn div_assign(&mut self, rhs: T)[src]

Performs the /= operation. Read more

impl<T: Float> Index<(usize, usize)> for Matrix4x4<T>[src]

Returns constant reference of i-th element.

type Output = T

The returned type after indexing.

fn index(&self, index: (usize, usize)) -> &Self::Output[src]

Performs the indexing (container[index]) operation. Read more

impl<T: Float> Index<usize> for Matrix4x4<T>[src]

Getter operators

Returns constant reference of i-th element.

type Output = T

The returned type after indexing.

fn index(&self, index: usize) -> &Self::Output[src]

Performs the indexing (container[index]) operation. Read more

impl<T: Float> IndexMut<(usize, usize)> for Matrix4x4<T>[src]

Returns reference of i-th element.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -4.0, 3.0, -2.0, 1.0);

let mut sign:f64 = -1.0;
for i in 0..16 {
    assert_eq!(sign * (16 - i) as f64, mat[i]);
    sign *= -1.0;

    mat[i] *= -1.0;
}

sign = 1.0;
for i in 0..4 {
    for j in 0..4 {
        let ans = sign * (16.0 - (4.0 * i as f64 + j as f64));
        assert_eq!(ans, mat[(i, j)]);
        sign *= -1.0;
    }
}

fn index_mut(&mut self, index: (usize, usize)) -> &mut Self::Output[src]

Performs the mutable indexing (container[index]) operation. Read more

impl<T: Float> IndexMut<usize> for Matrix4x4<T>[src]

Returns reference of i-th element.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -4.0, 3.0, -2.0, 1.0);

let mut sign:f64 = -1.0;
for i in 0..16 {
    assert_eq!(sign * (16 - i) as f64, mat[i]);
    sign *= -1.0;

    mat[i] *= -1.0;
}

sign = 1.0;
for i in 0..16 {
    assert_eq!(sign * (16 - i) as f64, mat[i]);
    sign *= -1.0;
}

fn index_mut(&mut self, index: usize) -> &mut Self::Output[src]

Performs the mutable indexing (container[index]) operation. Read more

impl<T: Float> Mul<Matrix4x4<T>> for Matrix4x4<T>[src]

Returns a * b.

type Output = Matrix4x4<T>

The resulting type after applying the * operator.

fn mul(self, rhs: Self) -> Self::Output[src]

Performs the * operation. Read more

impl<T: Float> Mul<T> for Matrix4x4<T>[src]

Returns a * b’, where every element of matrix b’ is b.

type Output = Matrix4x4<T>

The resulting type after applying the * operator.

fn mul(self, rhs: T) -> Self::Output[src]

Performs the * operation. Read more

impl<T: Float> Mul<Vector4<T>> for Matrix4x4<T>[src]

Returns a * b.

type Output = Vector4<T>

The resulting type after applying the * operator.

fn mul(self, rhs: Vector4<T>) -> Self::Output[src]

Performs the * operation. Read more

impl<T: Float> MulAssign<Matrix4x4<T>> for Matrix4x4<T>[src]

Multiplication assignment with input matrix.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -6.0, 3.0, -2.0, 1.0);

mat *= Matrix4x4D::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0);
assert_eq!(mat.is_similar(Matrix4x4D::new_lst([[102.0, 100.0, 98.0, 96.0],
                                                [70.0, 68.0, 66.0, 64.0],
                                                [38.0, 36.0, 34.0, 32.0],
                                                [4.0, 0.0, -4.0, -8.0]]), None), true);

fn mul_assign(&mut self, rhs: Self)[src]

Performs the *= operation. Read more

impl<T: Float> MulAssign<T> for Matrix4x4<T>[src]

Multiplication assignment with input scalar.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -6.0, 3.0, -2.0, 1.0);

mat *= 2.0;
assert_eq!(mat.is_similar(Matrix4x4D::new_lst([[-32.0, 30.0, -28.0, 26.0],
                                                [-24.0, 22.0, -20.0, 18.0],
                                                [-16.0, 14.0, -12.0, 10.0],
                                                [-12.0, 6.0, -4.0, 2.0]]), None), true);

fn mul_assign(&mut self, rhs: T)[src]

Performs the *= operation. Read more

impl<T: Float> Neg for Matrix4x4<T>[src]

fn neg(self) -> Self::Output[src]

Negative sign operator.

type Output = Matrix4x4<T>

The resulting type after applying the - operator.

impl<T: Float> PartialEq<Matrix4x4<T>> for Matrix4x4<T>[src]

Returns true if is equal to m.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new_default();

mat.set(-16.0, 15.0, -14.0, 13.0,
        -12.0, 11.0, -10.0, 9.0,
        -8.0, 7.0, -6.0, 5.0,
        -4.0, 3.0, -2.0, 1.0);
assert_eq!(mat == Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -4.0, 3.0, -2.0, 1.0), true);

fn eq(&self, m: &Self) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<T: Float> Sub<Matrix4x4<T>> for Matrix4x4<T>[src]

Returns a - b (element-size).

type Output = Matrix4x4<T>

The resulting type after applying the - operator.

fn sub(self, rhs: Self) -> Self::Output[src]

Performs the - operation. Read more

impl<T: Float> Sub<T> for Matrix4x4<T>[src]

Returns a - b’, where every element of matrix b’ is b.

type Output = Matrix4x4<T>

The resulting type after applying the - operator.

fn sub(self, rhs: T) -> Self::Output[src]

Performs the - operation. Read more

impl<T: Float> SubAssign<Matrix4x4<T>> for Matrix4x4<T>[src]

Subtraction assignment with input matrix (element-wise).

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -6.0, 3.0, -2.0, 1.0);

mat -= Matrix4x4D::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0);
assert_eq!(mat.is_similar(Matrix4x4D::new_lst([[-17.0, 13.0, -17.0, 9.0],
                                                [-17.0, 5.0, -17.0, 1.0],
                                                [-17.0, -3.0, -17.0, -7.0],
                                                [-19.0, -11.0, -17.0, -15.0]]), None), true);

fn sub_assign(&mut self, rhs: Self)[src]

Performs the -= operation. Read more

impl<T: Float> SubAssign<T> for Matrix4x4<T>[src]

Subtraction assignment with input scalar.

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -6.0, 3.0, -2.0, 1.0);

mat -= 2.0;
assert_eq!(mat.is_similar(Matrix4x4D::new_lst([[-18.0, 13.0, -16.0, 11.0],
                                                [-14.0, 9.0, -12.0, 7.0],
                                                [-10.0, 5.0, -8.0, 3.0],
                                                [-8.0, 1.0, -4.0, -1.0]]), None), true);

fn sub_assign(&mut self, rhs: T)[src]

Performs the -= operation. Read more

impl<T: Float> Copy for Matrix4x4<T>[src]

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mat = Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                            -12.0, 11.0, -10.0, 9.0,
                            -8.0, 7.0, -6.0, 5.0,
                            -6.0, 3.0, -2.0, 1.0);

let mat2 = mat;
assert_eq!(mat2.is_similar(Matrix4x4D::new(-16.0, 15.0, -14.0, 13.0,
                                        -12.0, 11.0, -10.0, 9.0,
                                        -8.0, 7.0, -6.0, 5.0,
                                        -6.0, 3.0, -2.0, 1.0), None), true);

impl<T: Float> Eq for Matrix4x4<T>[src]

use vox_geometry_rust::matrix4x4::Matrix4x4D;
let mut mat = Matrix4x4D::new_default();

mat.set(-16.0, 15.0, -14.0, 13.0,
        -12.0, 11.0, -10.0, 9.0,
        -8.0, 7.0, -6.0, 5.0,
        -4.0, 3.0, -2.0, 1.0);
assert_eq!(mat != Matrix4x4D::new(16.0, -15.0, 14.0, -13.0,
                                12.0, -11.0, 10.0, -9.0,
                                -8.0, 7.0, -6.0, 5.0,
                                -4.0, 3.0, -2.0, 1.0), true);

Auto Trait Implementations

impl<T> RefUnwindSafe for Matrix4x4<T> where
    T: RefUnwindSafe

impl<T> Send for Matrix4x4<T> where
    T: Send

impl<T> Sync for Matrix4x4<T> where
    T: Sync

impl<T> Unpin for Matrix4x4<T> where
    T: Unpin

impl<T> UnwindSafe for Matrix4x4<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Pointable for T

pub const ALIGN: usize

The alignment of pointer.

type Init = T

The type for initializers.

pub unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more

pub unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more

pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more

pub unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V