Struct cgmath::Matrix3 [] [src]

pub struct Matrix3<S> {
    pub x: Vector3<S>,
    pub y: Vector3<S>,
    pub z: Vector3<S>,
}

A 3 x 3, column major matrix

This type is marked as #[repr(C, packed)].

Fields

x: Vector3<S>

The first column of the matrix.

y: Vector3<S>

The second column of the matrix.

z: Vector3<S>

The third column of the matrix.

Methods

impl<S: BaseFloat> Matrix3<S>
[src]

fn new(c0r0: S, c0r1: S, c0r2: S, c1r0: S, c1r1: S, c1r2: S, c2r0: S, c2r1: S, c2r2: S) -> Matrix3<S>

Create a new matrix, providing values for each index.

fn from_cols(c0: Vector3<S>, c1: Vector3<S>, c2: Vector3<S>) -> Matrix3<S>

Create a new matrix, providing columns.

fn look_at(dir: Vector3<S>, up: Vector3<S>) -> Matrix3<S>

Create a rotation matrix that will cause a vector to point at dir, using up for orientation.

fn from_angle_x<A: Into<Rad<S>>>(theta: A) -> Matrix3<S>

Create a rotation matrix from a rotation around the x axis (pitch).

fn from_angle_y<A: Into<Rad<S>>>(theta: A) -> Matrix3<S>

Create a rotation matrix from a rotation around the y axis (yaw).

fn from_angle_z<A: Into<Rad<S>>>(theta: A) -> Matrix3<S>

Create a rotation matrix from a rotation around the z axis (roll).

fn from_axis_angle<A: Into<Rad<S>>>(axis: Vector3<S>, angle: A) -> Matrix3<S>

Create a rotation matrix from an angle around an arbitrary axis.

The specified axis must be normalized, or it represents an invalid rotation.

Trait Implementations

impl<S: PartialEq> PartialEq for Matrix3<S>
[src]

fn eq(&self, __arg_0: &Matrix3<S>) -> bool

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

fn ne(&self, __arg_0: &Matrix3<S>) -> bool

This method tests for !=.

impl<S: Clone> Clone for Matrix3<S>
[src]

fn clone(&self) -> Matrix3<S>

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl<S: Copy> Copy for Matrix3<S>
[src]

impl<S: Decodable> Decodable for Matrix3<S>
[src]

fn decode<__DS: Decoder>(__arg_0: &mut __DS) -> Result<Matrix3<S>, __DS::Error>

impl<S: Encodable> Encodable for Matrix3<S>
[src]

fn encode<__SS: Encoder>(&self, __arg_0: &mut __SS) -> Result<(), __SS::Error>

impl<S: BaseFloat> Zero for Matrix3<S>
[src]

fn zero() -> Matrix3<S>

Returns the additive identity element of Self, 0. Read more

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.

impl<S: BaseFloat> One for Matrix3<S>
[src]

fn one() -> Matrix3<S>

Returns the multiplicative identity element of Self, 1. Read more

impl<S: BaseFloat> VectorSpace for Matrix3<S>
[src]

type Scalar = S

The associated scalar.

impl<S: BaseFloat> Matrix for Matrix3<S>
[src]

type Column = Vector3<S>

The column vector of the matrix.

type Row = Vector3<S>

The row vector of the matrix.

type Transpose = Matrix3<S>

The result of transposing the matrix

fn row(&self, r: usize) -> Vector3<S>

Get a row from this matrix by-value.

fn swap_rows(&mut self, a: usize, b: usize)

Swap two rows of this array.

fn swap_columns(&mut self, a: usize, b: usize)

Swap two columns of this array.

fn swap_elements(&mut self, a: (usize, usize), b: (usize, usize))

Swap the values at index a and b

fn transpose(&self) -> Matrix3<S>

Transpose this matrix, returning a new matrix.

fn as_ptr(&self) -> *const Self::Scalar

Get the pointer to the first element of the array.

fn as_mut_ptr(&mut self) -> *mut Self::Scalar

Get a mutable pointer to the first element of the array.

fn replace_col(&mut self, c: usize, src: Self::Column) -> Self::Column

Replace a column in the array.

impl<S: BaseFloat> SquareMatrix for Matrix3<S>
[src]

type ColumnRow = Vector3<S>

The row/column vector of the matrix. Read more

fn from_value(value: S) -> Matrix3<S>

Create a new diagonal matrix using the supplied value.

fn from_diagonal(value: Vector3<S>) -> Matrix3<S>

Create a matrix from a non-uniform scale

fn transpose_self(&mut self)

Transpose this matrix in-place.

fn determinant(&self) -> S

Take the determinant of this matrix.

fn diagonal(&self) -> Vector3<S>

Return a vector containing the diagonal of this matrix.

fn invert(&self) -> Option<Matrix3<S>>

Invert this matrix, returning a new matrix. m.mul_m(m.invert()) is the identity matrix. Returns None if this matrix is not invertible (has a determinant of zero). Read more

fn is_diagonal(&self) -> bool

Test if this is a diagonal matrix. That is, every element outside of the diagonal is 0. Read more

fn is_symmetric(&self) -> bool

Test if this matrix is symmetric. That is, it is equal to its transpose. Read more

fn identity() -> Self

The [identity matrix]. Multiplying this matrix with another should have no effect. Read more

fn trace(&self) -> Self::Scalar

Return the trace of this matrix. That is, the sum of the diagonal.

fn is_invertible(&self) -> bool

Test if this matrix is invertible.

fn is_identity(&self) -> bool

Test if this matrix is the identity matrix. That is, it is diagonal and every element in the diagonal is one. Read more

impl<S: BaseFloat> ApproxEq for Matrix3<S>
[src]

type Epsilon = S

fn approx_eq_eps(&self, other: &Matrix3<S>, epsilon: &S) -> bool

fn approx_epsilon() -> Self::Epsilon

fn approx_eq(&self, other: &Self) -> bool

impl<S: BaseFloat> Transform<Point2<S>> for Matrix3<S>
[src]

fn one() -> Matrix3<S>

Create an identity transformation. That is, a transformation which does nothing. Read more

fn look_at(eye: Point2<S>, center: Point2<S>, up: Vector2<S>) -> Matrix3<S>

Create a transformation that rotates a vector to look at center from eye, using up for orientation. Read more

fn transform_vector(&self, vec: Vector2<S>) -> Vector2<S>

Transform a vector using this transform.

fn transform_point(&self, point: Point2<S>) -> Point2<S>

Transform a point using this transform.

fn concat(&self, other: &Matrix3<S>) -> Matrix3<S>

Combine this transform with another, yielding a new transformation which has the effects of both. Read more

fn inverse_transform(&self) -> Option<Matrix3<S>>

Create a transform that "un-does" this one.

fn concat_self(&mut self, other: &Self)

Combine this transform with another, in-place.

impl<S: BaseFloat> Transform<Point3<S>> for Matrix3<S>
[src]

fn one() -> Matrix3<S>

Create an identity transformation. That is, a transformation which does nothing. Read more

fn look_at(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix3<S>

Create a transformation that rotates a vector to look at center from eye, using up for orientation. Read more

fn transform_vector(&self, vec: Vector3<S>) -> Vector3<S>

Transform a vector using this transform.

fn transform_point(&self, point: Point3<S>) -> Point3<S>

Transform a point using this transform.

fn concat(&self, other: &Matrix3<S>) -> Matrix3<S>

Combine this transform with another, yielding a new transformation which has the effects of both. Read more

fn inverse_transform(&self) -> Option<Matrix3<S>>

Create a transform that "un-does" this one.

fn concat_self(&mut self, other: &Self)

Combine this transform with another, in-place.

impl<S: BaseFloat> Transform2<S> for Matrix3<S>
[src]

impl<S: BaseFloat> Transform3<S> for Matrix3<S>
[src]

impl<S: BaseFloat> Neg for Matrix3<S>
[src]

type Output = Matrix3<S>

The resulting type after applying the - operator

fn neg(self) -> Matrix3<S>

The method for the unary - operator

impl<'a, S: BaseFloat> Neg for &'a Matrix3<S>
[src]

type Output = Matrix3<S>

The resulting type after applying the - operator

fn neg(self) -> Matrix3<S>

The method for the unary - operator

impl<S: BaseFloat> Mul<S> for Matrix3<S>
[src]

type Output = Matrix3<S>

The resulting type after applying the * operator

fn mul(self, other: S) -> Matrix3<S>

The method for the * operator

impl<'a, S: BaseFloat> Mul<S> for &'a Matrix3<S>
[src]

type Output = Matrix3<S>

The resulting type after applying the * operator

fn mul(self, other: S) -> Matrix3<S>

The method for the * operator

impl<S: BaseFloat> Div<S> for Matrix3<S>
[src]

type Output = Matrix3<S>

The resulting type after applying the / operator

fn div(self, other: S) -> Matrix3<S>

The method for the / operator

impl<'a, S: BaseFloat> Div<S> for &'a Matrix3<S>
[src]

type Output = Matrix3<S>

The resulting type after applying the / operator

fn div(self, other: S) -> Matrix3<S>

The method for the / operator

impl<S: BaseFloat> Rem<S> for Matrix3<S>
[src]

type Output = Matrix3<S>

The resulting type after applying the % operator

fn rem(self, other: S) -> Matrix3<S>

The method for the % operator

impl<'a, S: BaseFloat> Rem<S> for &'a Matrix3<S>
[src]

type Output = Matrix3<S>

The resulting type after applying the % operator

fn rem(self, other: S) -> Matrix3<S>

The method for the % operator

impl<S: BaseFloat + MulAssign<S>> MulAssign<S> for Matrix3<S>
[src]

fn mul_assign(&mut self, scalar: S)

The method for the *= operator

impl<S: BaseFloat + DivAssign<S>> DivAssign<S> for Matrix3<S>
[src]

fn div_assign(&mut self, scalar: S)

The method for the /= operator

impl<S: BaseFloat + RemAssign<S>> RemAssign<S> for Matrix3<S>
[src]

fn rem_assign(&mut self, scalar: S)

The method for the %= operator

impl<S: BaseFloat> Add<Matrix3<S>> for Matrix3<S>
[src]

type Output = Matrix3<S>

The resulting type after applying the + operator

fn add(self, other: Matrix3<S>) -> Matrix3<S>

The method for the + operator

impl<'a, S: BaseFloat> Add<&'a Matrix3<S>> for Matrix3<S>
[src]

type Output = Matrix3<S>

The resulting type after applying the + operator

fn add(self, other: &'a Matrix3<S>) -> Matrix3<S>

The method for the + operator

impl<'a, S: BaseFloat> Add<Matrix3<S>> for &'a Matrix3<S>
[src]

type Output = Matrix3<S>

The resulting type after applying the + operator

fn add(self, other: Matrix3<S>) -> Matrix3<S>

The method for the + operator

impl<'a, 'b, S: BaseFloat> Add<&'a Matrix3<S>> for &'b Matrix3<S>
[src]

type Output = Matrix3<S>

The resulting type after applying the + operator

fn add(self, other: &'a Matrix3<S>) -> Matrix3<S>

The method for the + operator

impl<S: BaseFloat> Sub<Matrix3<S>> for Matrix3<S>
[src]

type Output = Matrix3<S>

The resulting type after applying the - operator

fn sub(self, other: Matrix3<S>) -> Matrix3<S>

The method for the - operator

impl<'a, S: BaseFloat> Sub<&'a Matrix3<S>> for Matrix3<S>
[src]

type Output = Matrix3<S>

The resulting type after applying the - operator

fn sub(self, other: &'a Matrix3<S>) -> Matrix3<S>

The method for the - operator

impl<'a, S: BaseFloat> Sub<Matrix3<S>> for &'a Matrix3<S>
[src]

type Output = Matrix3<S>

The resulting type after applying the - operator

fn sub(self, other: Matrix3<S>) -> Matrix3<S>

The method for the - operator

impl<'a, 'b, S: BaseFloat> Sub<&'a Matrix3<S>> for &'b Matrix3<S>
[src]

type Output = Matrix3<S>

The resulting type after applying the - operator

fn sub(self, other: &'a Matrix3<S>) -> Matrix3<S>

The method for the - operator

impl<S: BaseFloat + AddAssign<S>> AddAssign<Matrix3<S>> for Matrix3<S>
[src]

fn add_assign(&mut self, other: Matrix3<S>)

The method for the += operator

impl<S: BaseFloat + SubAssign<S>> SubAssign<Matrix3<S>> for Matrix3<S>
[src]

fn sub_assign(&mut self, other: Matrix3<S>)

The method for the -= operator

impl<S: BaseFloat> Mul<Vector3<S>> for Matrix3<S>
[src]

type Output = Vector3<S>

The resulting type after applying the * operator

fn mul(self, other: Vector3<S>) -> Vector3<S>

The method for the * operator

impl<'a, S: BaseFloat> Mul<&'a Vector3<S>> for Matrix3<S>
[src]

type Output = Vector3<S>

The resulting type after applying the * operator

fn mul(self, other: &'a Vector3<S>) -> Vector3<S>

The method for the * operator

impl<'a, S: BaseFloat> Mul<Vector3<S>> for &'a Matrix3<S>
[src]

type Output = Vector3<S>

The resulting type after applying the * operator

fn mul(self, other: Vector3<S>) -> Vector3<S>

The method for the * operator

impl<'a, 'b, S: BaseFloat> Mul<&'a Vector3<S>> for &'b Matrix3<S>
[src]

type Output = Vector3<S>

The resulting type after applying the * operator

fn mul(self, other: &'a Vector3<S>) -> Vector3<S>

The method for the * operator

impl<S: BaseFloat> Mul<Matrix3<S>> for Matrix3<S>
[src]

type Output = Matrix3<S>

The resulting type after applying the * operator

fn mul(self, other: Matrix3<S>) -> Matrix3<S>

The method for the * operator

impl<'a, S: BaseFloat> Mul<&'a Matrix3<S>> for Matrix3<S>
[src]

type Output = Matrix3<S>

The resulting type after applying the * operator

fn mul(self, other: &'a Matrix3<S>) -> Matrix3<S>

The method for the * operator

impl<'a, S: BaseFloat> Mul<Matrix3<S>> for &'a Matrix3<S>
[src]

type Output = Matrix3<S>

The resulting type after applying the * operator

fn mul(self, other: Matrix3<S>) -> Matrix3<S>

The method for the * operator

impl<'a, 'b, S: BaseFloat> Mul<&'a Matrix3<S>> for &'b Matrix3<S>
[src]

type Output = Matrix3<S>

The resulting type after applying the * operator

fn mul(self, other: &'a Matrix3<S>) -> Matrix3<S>

The method for the * operator

impl<S> Index<usize> for Matrix3<S>
[src]

type Output = Vector3<S>

The returned type after indexing

fn index<'a>(&'a self, i: usize) -> &'a Vector3<S>

The method for the indexing (Foo[Bar]) operation

impl<S> IndexMut<usize> for Matrix3<S>
[src]

fn index_mut<'a>(&'a mut self, i: usize) -> &'a mut Vector3<S>

The method for the indexing (Foo[Bar]) operation

impl<A> From<Euler<A>> for Matrix3<A::Unitless> where A: Angle + Into<Rad<A::Unitless>>
[src]

fn from(src: Euler<A>) -> Matrix3<A::Unitless>

Performs the conversion.

impl<S> Into<[[S; 3]; 3]> for Matrix3<S>
[src]

fn into(self) -> [[S; 3]; 3]

Performs the conversion.

impl<S> AsRef<[[S; 3]; 3]> for Matrix3<S>
[src]

fn as_ref(&self) -> &[[S; 3]; 3]

Performs the conversion.

impl<S> AsMut<[[S; 3]; 3]> for Matrix3<S>
[src]

fn as_mut(&mut self) -> &mut [[S; 3]; 3]

Performs the conversion.

impl<S: Copy> From<[[S; 3]; 3]> for Matrix3<S>
[src]

fn from(m: [[S; 3]; 3]) -> Matrix3<S>

Performs the conversion.

impl<'a, S> From<&'a [[S; 3]; 3]> for &'a Matrix3<S>
[src]

fn from(m: &'a [[S; 3]; 3]) -> &'a Matrix3<S>

Performs the conversion.

impl<'a, S> From<&'a mut [[S; 3]; 3]> for &'a mut Matrix3<S>
[src]

fn from(m: &'a mut [[S; 3]; 3]) -> &'a mut Matrix3<S>

Performs the conversion.

impl<S> AsRef<[S; 9]> for Matrix3<S>
[src]

fn as_ref(&self) -> &[S; 9]

Performs the conversion.

impl<S> AsMut<[S; 9]> for Matrix3<S>
[src]

fn as_mut(&mut self) -> &mut [S; 9]

Performs the conversion.

impl<'a, S> From<&'a [S; 9]> for &'a Matrix3<S>
[src]

fn from(m: &'a [S; 9]) -> &'a Matrix3<S>

Performs the conversion.

impl<'a, S> From<&'a mut [S; 9]> for &'a mut Matrix3<S>
[src]

fn from(m: &'a mut [S; 9]) -> &'a mut Matrix3<S>

Performs the conversion.

impl<S: BaseFloat> From<Matrix2<S>> for Matrix3<S>
[src]

fn from(m: Matrix2<S>) -> Matrix3<S>

Clone the elements of a 2-dimensional matrix into the top-left corner of a 3-dimensional identity matrix.

impl<S: Debug> Debug for Matrix3<S>
[src]

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<S: BaseFloat + Rand> Rand for Matrix3<S>
[src]

fn rand<R: Rng>(rng: &mut R) -> Matrix3<S>

Generates a random instance of this type using the specified source of randomness. Read more

impl<S: BaseFloat> From<Quaternion<S>> for Matrix3<S>
[src]

fn from(quat: Quaternion<S>) -> Matrix3<S>

Convert the quaternion to a 3 x 3 rotation matrix

impl<S: BaseFloat> From<Basis3<S>> for Matrix3<S>
[src]

fn from(b: Basis3<S>) -> Matrix3<S>

Performs the conversion.

impl<S: BaseFloat, R: Rotation2<S>> From<Decomposed<Vector2<S>, R>> for Matrix3<S>
[src]

fn from(dec: Decomposed<Vector2<S>, R>) -> Matrix3<S>

Performs the conversion.