[−][src]Struct ezcgmath::matrix::Matrix4x4
A 4 x 4 Matrix.
Fields
c00: Scalar
c10: Scalar
c20: Scalar
c30: Scalar
c01: Scalar
c11: Scalar
c21: Scalar
c31: Scalar
c02: Scalar
c12: Scalar
c22: Scalar
c32: Scalar
c03: Scalar
c13: Scalar
c23: Scalar
c33: Scalar
Implementations
impl Matrix4x4
[src]
pub const fn identity() -> Self
[src]
pub fn new_perspective_projection(
fov: Degrees,
aspect_ratio: Scalar,
near_plane: Scalar,
far_plane: Scalar
) -> Self
[src]
fov: Degrees,
aspect_ratio: Scalar,
near_plane: Scalar,
far_plane: Scalar
) -> Self
Constructs a new perspective projection. As a reminder, this will create a left-handed perspective matrix. If you require a right-handed coordinate system, you'll have to convert to it with with a reflection matrix.
The parameters follow convention as far as I am aware, but to clarify:
fovy
corresponds to the width of the field of view visible (or how far out you can hold your arms).aspect ratio
is the ratio of width to height for the screen (so aspect_ratio = screen_width / screen_height).near_plane
defines the start of the clipping volume for the camera along the z (the minimum distance at which objects can be rendered).far_plane
defines the end of the clipping volume for the camera along the z (the maximum distance at which objects can be rendered).
pub fn new_orthographic_projection(
top: Scalar,
bottom: Scalar,
left: Scalar,
right: Scalar,
near_plane: Scalar,
far_plane: Scalar
) -> Self
[src]
top: Scalar,
bottom: Scalar,
left: Scalar,
right: Scalar,
near_plane: Scalar,
far_plane: Scalar
) -> Self
Constructs a new orthographic projection. As a reminder, this will create a left-handed orthographic matrix. If you require a right-handed coordinate system, you'll have to convert to it with with a reflection matrix.
I opted for simple parameters for this method, so you can create any size or shape orthographic bounding volume you desire.
However, my advice would be for your code to define an orthographic_size
variable somehow. You can then convert to top/bottom/left/right as follows:
struct OrthoBounds { top: f32, bottom: f32, left: f32, right: f32, } fn get_ortho_bounds(orthographic_size: f32, aspect_ratio: f32) -> OrthoBounds { OrthoBounds { top: 0.5 * orthographic_size, bottom: -0.5 * orthographic_size, left: -0.5 * orthographic_size * aspect_ratio, right: 0.5 * orthographic_size * aspect_ratio, } }
If you choose not to use the above method, bear in mind that top - bottom
and right - left
should never equal 0. This will cause a panic.
pub const fn from_translation(translation: &Vector3) -> Self
[src]
Creates a translation matrix from a Vector3
.
pub const fn from_nonuniform_scale(scale: &Vector3) -> Self
[src]
Creates a non-uniform scaling matrix from a Vector3
.
pub const fn from_scale(scale: Scalar) -> Self
[src]
Creates a uniform scaling matrix from a Scalar
.
pub fn matrix_of_minors(&self) -> Matrix4x4
[src]
Compiles a matrix of minors for this matrix.
pub fn matrix_of_cofactors(&self) -> Matrix4x4
[src]
Compiles a matrix of cofactors for this matrix.
pub fn transpose(&self) -> Matrix4x4
[src]
Returns a new matrix with the elements transposed.
pub fn determinant(&self) -> f32
[src]
Calculates the determinant for this matrix.
pub fn inverse(&self) -> Matrix4x4
[src]
Calculates the Inverse matrix for this matrix.
Trait Implementations
impl AbsDiffEq<Matrix4x4> for Matrix4x4
[src]
type Epsilon = Scalar
Used for specifying relative comparisons.
fn default_epsilon() -> Self::Epsilon
[src]
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
[src]
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
[src]
impl Add<Matrix4x4> for Matrix4x4
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: Self) -> Self
[src]
impl AddAssign<Matrix4x4> for Matrix4x4
[src]
fn add_assign(&mut self, rhs: Self)
[src]
impl Clone for Matrix4x4
[src]
impl Copy for Matrix4x4
[src]
impl Debug for Matrix4x4
[src]
impl Default for Matrix4x4
[src]
impl From<Quaternion> for Matrix4x4
[src]
fn from(rotation: Quaternion) -> Self
[src]
impl Mul<Matrix4x4> for Matrix4x4
[src]
type Output = Matrix4x4
The resulting type after applying the *
operator.
fn mul(self, rhs: Matrix4x4) -> Matrix4x4
[src]
impl Mul<Matrix4x4> for Quaternion
[src]
type Output = Matrix4x4
The resulting type after applying the *
operator.
fn mul(self, rhs: Matrix4x4) -> Matrix4x4
[src]
impl Mul<Matrix4x4> for Vector3
[src]
type Output = Vector3
The resulting type after applying the *
operator.
fn mul(self, rhs: Matrix4x4) -> Vector3
[src]
impl Mul<Matrix4x4> for Vector4
[src]
type Output = Vector4
The resulting type after applying the *
operator.
fn mul(self, rhs: Matrix4x4) -> Vector4
[src]
impl Mul<Quaternion> for Matrix4x4
[src]
type Output = Matrix4x4
The resulting type after applying the *
operator.
fn mul(self, rhs: Quaternion) -> Self::Output
[src]
impl Mul<f32> for Matrix4x4
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: Scalar) -> Self
[src]
impl MulAssign<Matrix4x4> for Matrix4x4
[src]
fn mul_assign(&mut self, rhs: Matrix4x4)
[src]
impl MulAssign<Matrix4x4> for Vector3
[src]
fn mul_assign(&mut self, rhs: Matrix4x4)
[src]
impl MulAssign<Matrix4x4> for Vector4
[src]
fn mul_assign(&mut self, rhs: Matrix4x4)
[src]
impl MulAssign<Quaternion> for Matrix4x4
[src]
fn mul_assign(&mut self, rhs: Quaternion)
[src]
impl MulAssign<f32> for Matrix4x4
[src]
fn mul_assign(&mut self, rhs: Scalar)
[src]
impl PartialEq<Matrix4x4> for Matrix4x4
[src]
impl RelativeEq<Matrix4x4> for Matrix4x4
[src]
fn default_max_relative() -> Self::Epsilon
[src]
fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
[src]
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
[src]
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
impl StructuralPartialEq for Matrix4x4
[src]
impl Sub<Matrix4x4> for Matrix4x4
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: Matrix4x4) -> Self
[src]
impl SubAssign<Matrix4x4> for Matrix4x4
[src]
fn sub_assign(&mut self, rhs: Matrix4x4)
[src]
impl UlpsEq<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> 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>,