Struct bevy_math::DMat2

source ·
pub struct DMat2 {
    pub x_axis: DVec2,
    pub y_axis: DVec2,
}
Expand description

A 2x2 column major matrix.

Fields§

§x_axis: DVec2§y_axis: DVec2

Implementations§

A 2x2 matrix with all elements set to 0.0.

A 2x2 identity matrix, where all diagonal elements are 1, and all off-diagonal elements are 0.

All NAN:s.

Creates a 2x2 matrix from two column vectors.

Creates a 2x2 matrix from a [f64; 4] array stored in column major order. If your data is stored in row major you will need to transpose the returned matrix.

Creates a [f64; 4] array storing data in column major order. If you require data in row major order transpose the matrix first.

Creates a 2x2 matrix from a [[f64; 2]; 2] 2D array stored in column major order. If your data is in row major order you will need to transpose the returned matrix.

Creates a [[f64; 2]; 2] 2D array storing data in column major order. If you require data in row major order transpose the matrix first.

Creates a 2x2 matrix with its diagonal set to diagonal and all other entries set to 0.

Creates a 2x2 matrix containing the combining non-uniform scale and rotation of angle (in radians).

Creates a 2x2 matrix containing a rotation of angle (in radians).

Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column.

Creates a 2x2 matrix from the first 4 values in slice.

Panics

Panics if slice is less than 4 elements long.

Writes the columns of self to the first 4 elements in slice.

Panics

Panics if slice is less than 4 elements long.

Returns the matrix column for the given index.

Panics

Panics if index is greater than 1.

Returns a mutable reference to the matrix column for the given index.

Panics

Panics if index is greater than 1.

Returns the matrix row for the given index.

Panics

Panics if index is greater than 1.

Returns true if, and only if, all elements are finite. If any element is either NaN, positive or negative infinity, this will return false.

Returns true if any elements are NaN.

Returns the transpose of self.

Returns the determinant of self.

Returns the inverse of self.

If the matrix is not invertible the returned matrix will be invalid.

Panics

Will panic if the determinant of self is zero when glam_assert is enabled.

Transforms a 2D vector.

Multiplies two 2x2 matrices.

Adds two 2x2 matrices.

Subtracts two 2x2 matrices.

Multiplies a 2x2 matrix by a scalar.

Returns true if the absolute difference of all elements between self and rhs is less than or equal to max_abs_diff.

This can be used to compare if two matrices contain similar elements. It works best when comparing with a known value. The max_abs_diff that should be used used depends on the values being compared against.

For more see comparing floating point numbers.

Trait Implementations§

The resulting type after applying the + operator.
Performs the + operation. Read more
Performs the += operation. Read more
Converts this type into a mutable reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Formats the value using the given formatter. Read more
The resulting type after applying the * operator.
Performs the * operation. Read more
The resulting type after applying the * operator.
Performs the * operation. Read more
The resulting type after applying the * operator.
Performs the * operation. Read more
Performs the *= operation. Read more
Performs the *= operation. Read more
The resulting type after applying the - operator.
Performs the unary - operation. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Method which takes an iterator and generates Self from the elements by multiplying the items. Read more
Method which takes an iterator and generates Self from the elements by multiplying the items. Read more
The resulting type after applying the - operator.
Performs the - operation. Read more
Performs the -= operation. Read more
Method which takes an iterator and generates Self from the elements by “summing up” the items. Read more
Method which takes an iterator and generates Self from the elements by “summing up” the items. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern. Read more
If this function returns true, then it must be valid to reinterpret bits as &Self. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.