FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    Matrix4x4

    struct · ferroui-base · v0.5.0

    struct Matrix4x4
    

    A 4x4 matrix (a three-dimensional transform).

    The layout is the one of the reference runtime and is relied on when the value is passed to a graphics API by address: sixteen consecutive singles in row order (m11 to m14, then the second, third and fourth row).

    View source

    Members

    m11

    m11: f32
    

    The first element of the first row.

    Source

    m12

    m12: f32
    

    The second element of the first row.

    Source

    m13

    m13: f32
    

    The third element of the first row.

    Source

    m14

    m14: f32
    

    The fourth element of the first row.

    Source

    m21

    m21: f32
    

    The first element of the second row.

    Source

    m22

    m22: f32
    

    The second element of the second row.

    Source

    m23

    m23: f32
    

    The third element of the second row.

    Source

    m24

    m24: f32
    

    The fourth element of the second row.

    Source

    m31

    m31: f32
    

    The first element of the third row.

    Source

    m32

    m32: f32
    

    The second element of the third row.

    Source

    m33

    m33: f32
    

    The third element of the third row.

    Source

    m34

    m34: f32
    

    The fourth element of the third row.

    Source

    m41

    m41: f32
    

    The first element of the fourth row.

    Source

    m42

    m42: f32
    

    The second element of the fourth row.

    Source

    m43

    m43: f32
    

    The third element of the fourth row.

    Source

    m44

    m44: f32
    

    The fourth element of the fourth row.

    Source

    IDENTITY

    const IDENTITY: Matrix4x4
    

    The multiplicative identity matrix.

    Source

    new

    const fn new(m11: f32, m12: f32, m13: f32, m14: f32, m21: f32, m22: f32, m23: f32, m24: f32, m31: f32, m32: f32, m33: f32, m34: f32, m41: f32, m42: f32, m43: f32, m44: f32) -> Self
    

    Creates a 4x4 matrix from the specified components, given in row order.

    Source

    from_matrix3x2

    const fn from_matrix3x2(value: Matrix3x2) -> Self
    

    Creates a 4x4 matrix from the specified 3x2 matrix.

    Source

    is_identity

    fn is_identity(self: &Self) -> bool
    

    Indicates whether the current matrix is the identity matrix.

    Source

    translation

    fn translation(self: &Self) -> Vector3
    

    Gets the translation component of this matrix.

    Source

    set_translation

    fn set_translation(self: &mut Self, value: Vector3)
    

    Sets the translation component of this matrix.

    Source

    create_from_axis_angle

    fn create_from_axis_angle(axis: Vector3, angle: f32) -> Matrix4x4
    

    Creates a matrix that rotates around an arbitrary (unit) vector.

    As in the reference runtime, the matrix is built from the quaternion of the rotation.

    Source

    create_from_quaternion

    fn create_from_quaternion(quaternion: Quaternion) -> Matrix4x4
    

    Creates a rotation matrix from the specified quaternion rotation value.

    Source

    create_from_yaw_pitch_roll

    fn create_from_yaw_pitch_roll(yaw: f32, pitch: f32, roll: f32) -> Matrix4x4
    

    Creates a rotation matrix from the specified yaw, pitch, and roll.

    Source

    create_look_at

    fn create_look_at(camera_position: Vector3, camera_target: Vector3, camera_up_vector: Vector3) -> Matrix4x4
    

    Creates a view matrix: a camera at camera_position that looks at camera_target, with camera_up_vector as the direction that is up from the camera's point of view (right-handed).

    As in the reference runtime, nothing is validated: a target at the position of the camera, or an up vector parallel to the direction of view, gives NaN components.

    Source

    create_perspective_field_of_view

    fn create_perspective_field_of_view(field_of_view: f32, aspect_ratio: f32, near_plane_distance: f32, far_plane_distance: f32) -> Matrix4x4
    

    Creates a perspective projection matrix based on a field of view, aspect ratio, and near and far view plane distances (right-handed, with a depth range of zero to one).

    field_of_view is the field of view in the y direction, in radians. A far plane at positive infinity is accepted and gives the limit of the matrix (m33 is -1 and m43 is -near_plane_distance).

    Panics

    Panics where the reference runtime throws an ArgumentOutOfRangeException: when field_of_view is less than or equal to zero or greater than or equal to pi, when near_plane_distance or far_plane_distance is less than or equal to zero, and when near_plane_distance is greater than or equal to far_plane_distance.

    Source

    create_rotation_x

    fn create_rotation_x(radians: f32) -> Matrix4x4
    

    Creates a matrix for rotating points around the X axis.

    Source

    create_rotation_x_at

    fn create_rotation_x_at(radians: f32, center_point: Vector3) -> Matrix4x4
    

    Creates a matrix for rotating points around the X axis from a center point.

    Source

    create_rotation_y

    fn create_rotation_y(radians: f32) -> Matrix4x4
    

    Creates a matrix for rotating points around the Y axis.

    Source

    create_rotation_y_at

    fn create_rotation_y_at(radians: f32, center_point: Vector3) -> Matrix4x4
    

    Creates a matrix for rotating points around the Y axis from a center point.

    Source

    create_rotation_z

    fn create_rotation_z(radians: f32) -> Matrix4x4
    

    Creates a matrix for rotating points around the Z axis.

    Source

    create_rotation_z_at

    fn create_rotation_z_at(radians: f32, center_point: Vector3) -> Matrix4x4
    

    Creates a matrix for rotating points around the Z axis from a center point.

    Source

    create_scale

    fn create_scale(scales: Vector3) -> Matrix4x4
    

    Creates a scaling matrix from the specified vector scale.

    Source

    create_scale_xyz

    fn create_scale_xyz(x_scale: f32, y_scale: f32, z_scale: f32) -> Matrix4x4
    

    Creates a scaling matrix from the specified X, Y, and Z components.

    Source

    create_scale_uniform

    fn create_scale_uniform(scale: f32) -> Matrix4x4
    

    Creates a uniform scaling matrix that scales equally on each axis.

    Source

    create_scale_at

    fn create_scale_at(scales: Vector3, center_point: Vector3) -> Matrix4x4
    

    Creates a scaling matrix with a center point.

    Source

    create_translation

    fn create_translation(position: Vector3) -> Matrix4x4
    

    Creates a translation matrix from the specified 3-dimensional vector.

    Source

    create_translation_xyz

    fn create_translation_xyz(x_position: f32, y_position: f32, z_position: f32) -> Matrix4x4
    

    Creates a translation matrix from the specified X, Y, and Z components.

    Source

    get_determinant

    fn get_determinant(self: &Self) -> f32
    

    Calculates the determinant of the current 4x4 matrix.

    Source

    invert

    fn invert(matrix: Matrix4x4) -> Option<Matrix4x4>
    

    Tries to invert the specified matrix. Returns None when the matrix is singular; see Matrix4x4::invert_or_nan for the value the reference runtime stores in that case.

    Source

    invert_or_nan

    fn invert_or_nan(matrix: Matrix4x4) -> Matrix4x4
    

    Inverts the specified matrix; a singular matrix gives a matrix whose components are all NaN (the out value of the reference runtime).

    Source

    lerp

    fn lerp(matrix1: Matrix4x4, matrix2: Matrix4x4, amount: f32) -> Matrix4x4
    

    Performs a linear interpolation from one matrix to a second matrix based on a value that specifies the weighting of the second matrix.

    Source

    transpose

    fn transpose(matrix: Matrix4x4) -> Matrix4x4
    

    Transposes the rows and columns of a matrix.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • PropertyValue
    • AnyValue
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ToString
    • ErasedDestructor
    • IntoEither
    • Clone
    • Copy
    • Debug
    • StructuralPartialEq
    • PartialEq
    • Default
    • Add
    • Sub
    • Neg
    • Mul
    • Mul<f32>
    • Display
    • From<Matrix4x4>
    • ExpressionVariantValue
    • BatchValue

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.