Struct nalgebra::PerspMat3 [] [src]

pub struct PerspMat3<N> {
    // some fields omitted
}

A 3D perspective projection stored as a 4D matrix.

This maps a frustrum to the unit cube with corners varying from (-1, -1, -1) to (1, 1, 1). Reading or modifying its individual properties is costly but applying the transformation is cheap.

Methods

impl<N: BaseFloat> PerspMat3<N>
[src]

fn new(aspect: N, fovy: N, znear: N, zfar: N) -> PerspMat3<N>

Creates a new perspective matrix from the aspect ratio, y field of view, and near/far planes.

unsafe fn new_with_mat(mat: Mat4<N>) -> PerspMat3<N>

Creates a new perspective projection matrix from a 4D matrix.

This is unsafe because the input matrix is not checked to be a perspective projection.

fn as_mat<'a>(&'a self) -> &'a Mat4<N>

Returns a reference to the 4D matrix (using homogeneous coordinates) of this projection.

fn aspect(&self) -> N

Gets the width / height aspect ratio of the view frustrum.

fn fovy(&self) -> N

Gets the y field of view of the view frustrum.

fn znear(&self) -> N

Gets the near plane offset of the view frustrum.

fn zfar(&self) -> N

Gets the far plane offset of the view frustrum.

fn set_aspect(&mut self, aspect: N)

Updates this projection matrix with a new width / height aspect ratio of the view frustrum.

fn set_fovy(&mut self, fovy: N)

Updates this projection with a new y field of view of the view frustrum.

fn set_znear(&mut self, znear: N)

Updates this projection matrix with a new near plane offset of the view frustrum.

fn set_zfar(&mut self, zfar: N)

Updates this projection matrix with a new far plane offset of the view frustrum.

fn set_znear_and_zfar(&mut self, znear: N, zfar: N)

Updates this projection matrix with new near and far plane offsets of the view frustrum.

fn project_pnt(&self, p: &Pnt3<N>) -> Pnt3<N>

Projects a point.

fn project_vec(&self, p: &Vec3<N>) -> Vec3<N>

Projects a vector.

impl<N: BaseFloat + Clone> PerspMat3<N>
[src]

fn to_mat<'a>(&'a self) -> Mat4<N>

Returns the 4D matrix (using homogeneous coordinates) of this projection.

Trait Implementations

impl<N: Copy> Copy for PerspMat3<N>
[src]

impl<N: Debug> Debug for PerspMat3<N>
[src]

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

Formats the value using the given formatter.

impl<N: Clone> Clone for PerspMat3<N>
[src]

fn clone(&self) -> PerspMat3<N>

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<N: Decodable> Decodable for PerspMat3<N>
[src]

fn decode<__DN: Decoder>(__arg_0: &mut __DN) -> Result<PerspMat3<N>, __DN::Error>

impl<N: Encodable> Encodable for PerspMat3<N>
[src]

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

impl<N: PartialEq> PartialEq for PerspMat3<N>
[src]

fn eq(&self, __arg_0: &PerspMat3<N>) -> bool

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

fn ne(&self, __arg_0: &PerspMat3<N>) -> bool

This method tests for !=.

impl<N: Eq> Eq for PerspMat3<N>
[src]