Matrix4 in nalgebra::base - Rust
Description: A stack-allocated, column-major, 4x4 square matrix.
Keywords: rust, rustlang, rust-lang, Matrix4

# Type Definition nalgebra::base::Matrix4

source ·

    pub type Matrix4<T> = Matrix<T, U4, U4, ArrayStorage<T, 4, 4>>;

Expand description

A stack-allocated, column-major, 4x4 square matrix.

Because this is an alias, not all its methods are listed here. See the `Matrix` type too.

## Implementations§

source§

### impl<T: RealField> Matrix4<T>

#### 3D transformations as a Matrix4

source

#### pub fn new_rotation(axisangle: Vector3<T>) -> Self

Builds a 3D homogeneous rotation matrix from an axis and an angle (multiplied together).

Returns the identity matrix if the given argument is zero.

source

#### pub fn new_rotation_wrt_point(axisangle: Vector3<T>, pt: Point3<T>) -> Self

Builds a 3D homogeneous rotation matrix from an axis and an angle (multiplied together).

Returns the identity matrix if the given argument is zero.

source

#### pub fn new_nonuniform_scaling_wrt_point(
scaling: &Vector3<T>,
pt: &Point3<T>
) -> Self

Creates a new homogeneous matrix that applies a scaling factor for each dimension with respect to point.

Can be used to implement `zoom_to` functionality.

source

#### pub fn from_scaled_axis(axisangle: Vector3<T>) -> Self

Builds a 3D homogeneous rotation matrix from an axis and an angle (multiplied together).

Returns the identity matrix if the given argument is zero. This is identical to `Self::new_rotation`.

source

#### pub fn from_euler_angles(roll: T, pitch: T, yaw: T) -> Self

Creates a new rotation from Euler angles.

The primitive rotations are applied in order: 1 roll − 2 pitch − 3 yaw.

source

#### pub fn from_axis_angle(axis: &Unit<Vector3<T>>, angle: T) -> Self

Builds a 3D homogeneous rotation matrix from an axis and a rotation angle.

source

#### pub fn new_orthographic(
left: T,
right: T,
bottom: T,
top: T,
znear: T,
zfar: T
) -> Self

Creates a new homogeneous matrix for an orthographic projection.

source

#### pub fn new_perspective(aspect: T, fovy: T, znear: T, zfar: T) -> Self

Creates a new homogeneous matrix for a perspective projection.

source

#### pub fn face_towards(eye: &Point3<T>, target: &Point3<T>, up: &Vector3<T>) -> Self

Creates an isometry that corresponds to the local frame of an observer standing at the point `eye` and looking toward `target`.

It maps the view direction `target - eye` to the positive `z` axis and the origin to the `eye`.

source

#### pub fn new_observer_frame(
eye: &Point3<T>,
target: &Point3<T>,
up: &Vector3<T>
) -> Self

👎Deprecated: renamed to `face_towards`

Deprecated: Use `Matrix4::face_towards` instead.

source

#### pub fn look_at_rh(eye: &Point3<T>, target: &Point3<T>, up: &Vector3<T>) -> Self

Builds a right-handed look-at view matrix.

source

#### pub fn look_at_lh(eye: &Point3<T>, target: &Point3<T>, up: &Vector3<T>) -> Self

Builds a left-handed look-at view matrix.

## Trait Implementations§

source§

### impl<T: RealField> From<Orthographic3<T>> for Matrix4<T>

source§

#### fn from(orth: Orthographic3<T>) -> Self

Converts to this type from the input type.
source§

### impl<T: RealField> From<Perspective3<T>> for Matrix4<T>

source§

#### fn from(pers: Perspective3<T>) -> Self

Converts to this type from the input type.
source§

### impl<T: RealField> From<Rotation<T, 3>> for Matrix4<T>

source§

#### fn from(q: Rotation3<T>) -> Self

Converts to this type from the input type.
source§

### impl<T: SimdRealField + RealField> From<Unit<DualQuaternion<T>>> for Matrix4<T>where
T::Element: SimdRealField,

source§

#### fn from(dq: UnitDualQuaternion<T>) -> Self

Converts to this type from the input type.
source§

### impl<T: SimdRealField> From<Unit<Quaternion<T>>> for Matrix4<T>where
T::Element: SimdRealField,

source§

#### fn from(q: UnitQuaternion<T>) -> Self

Converts to this type from the input type.