[−][src]Struct pbrt::core::transform::Matrix4x4
Matrix4x4 represents a 4x4 matrix in row-major form. So, element m[i][j]
corresponds to mi,j
where i
is the row number and j
is the column number.
Methods
impl Matrix4x4
[src]
pub fn identity() -> Matrix4x4
[src]
Create a Matrix4x4
containing the identity, all zeros with ones along the diagonal.
pub fn new(
r0: [Float; 4],
r1: [Float; 4],
r2: [Float; 4],
r3: [Float; 4]
) -> Matrix4x4
[src]
r0: [Float; 4],
r1: [Float; 4],
r2: [Float; 4],
r3: [Float; 4]
) -> Matrix4x4
Create a Matrix4x4
with each of the given rows.
pub fn transpose(&self) -> Matrix4x4
[src]
Transpose self, returning a new matrix that has been reflected across the diagonal.
Examples
use pbrt::core::transform::Matrix4x4; let m = Matrix4x4::new( [2., 0., 0., 0.], [3., 1., 0., 0.], [4., 0., 1., 0.], [5., 6., 7., 1.], ); let m_t = Matrix4x4::new( [2., 3., 4., 5.], [0., 1., 0., 6.], [0., 0., 1., 7.], [0., 0., 0., 1.], ); assert_eq!(m.transpose(), m_t);
pub fn inverse(&self) -> Matrix4x4
[src]
Returns a new matrix that is the inverse of self. If self is A, inverse returns A-1, where AA-1 = I. This implementation uses a numerically stable Gauss–Jordan elimination routine to compute the inverse.
Examples
use pbrt::core::transform::Matrix4x4; let i = Matrix4x4::identity(); assert_eq!(i.inverse() * i, i); let m = Matrix4x4::new( [2., 0., 0., 0.], [0., 3., 0., 0.], [0., 0., 4., 0.], [0., 0., 0., 1.], ); assert_eq!(m.inverse() * m, i); assert_eq!(m * m.inverse(), i);
Trait Implementations
impl Clone for Matrix4x4
[src]
impl Copy for Matrix4x4
[src]
impl Debug for Matrix4x4
[src]
impl Default for Matrix4x4
[src]
impl From<[f32; 16]> for Matrix4x4
[src]
impl From<Matrix4x4> for Transform
[src]
impl Mul<Matrix4x4> for Matrix4x4
[src]
type Output = Matrix4x4
The resulting type after applying the *
operator.
fn mul(self, m2: Matrix4x4) -> Matrix4x4
[src]
Implement matrix multiplication for Matrix4x4
.
Examples
use pbrt::core::transform::Matrix4x4; let i = Matrix4x4::identity(); let m1 = Matrix4x4::identity(); let m2 = Matrix4x4::identity(); assert_eq!(m1 * m2, i);
impl PartialEq<Matrix4x4> for Matrix4x4
[src]
Auto Trait Implementations
impl RefUnwindSafe for Matrix4x4
impl Send for Matrix4x4
impl Sync for Matrix4x4
impl Unpin for Matrix4x4
impl UnwindSafe for Matrix4x4
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,