pub struct Transform3D<T> {
pub columns: [[T; 4]; 4],
}Expand description
Rank 4 row-major transformation matrix for 3D objects.
Fields§
§columns: [[T; 4]; 4]This field contains the entries of this matrix in column-major order.
Implementations§
Source§impl<T> Transform3D<T>
impl<T> Transform3D<T>
Sourcepub fn new(columns: [[T; 4]; 4]) -> Transform3D<T>
pub fn new(columns: [[T; 4]; 4]) -> Transform3D<T>
Returns a new transformation matrix with the given entries in row-major order. This function does not perform any kind of validation on the given entries. It is the caller’s responsibility to ensure that the given entries result in a valid transformation matrix.
Sourcepub fn map<F, O>(self, op: F) -> Transform3D<O>where
F: FnMut(T) -> O,
pub fn map<F, O>(self, op: F) -> Transform3D<O>where
F: FnMut(T) -> O,
Applies the given transformation to each entry in the transformation matrix individually.
Source§impl<T> Transform3D<T>where
T: Float,
impl<T> Transform3D<T>where
T: Float,
Sourcepub fn identity() -> Transform3D<T>
pub fn identity() -> Transform3D<T>
Returns a new identity matrix, i.e. a matrix of zeros with ones on the diagonal.
Sourcepub fn with_perspective(d: T) -> Transform3D<T>
pub fn with_perspective(d: T) -> Transform3D<T>
Returns a new transformation matrix for a perspective with the given depth.
Sourcepub fn with_translation(tx: T, ty: T, tz: T) -> Transform3D<T>
pub fn with_translation(tx: T, ty: T, tz: T) -> Transform3D<T>
Returns a new transformation matrix for a translation with the given offsets.
Sourcepub fn with_scale(sx: T, sy: T, sz: T) -> Transform3D<T>
pub fn with_scale(sx: T, sy: T, sz: T) -> Transform3D<T>
Returns a new transformation matrix for a scale with the given factors.
Sourcepub fn with_skew_x(sx: T) -> Transform3D<T>
pub fn with_skew_x(sx: T) -> Transform3D<T>
Returns a new transformation matrix for a horizontal skew with the given angle radians.
Sourcepub fn with_skew_y(sy: T) -> Transform3D<T>
pub fn with_skew_y(sy: T) -> Transform3D<T>
Returns a new transformation matrix for a vertical skew with the given angle radians.
Sourcepub fn with_rotation(q: Quaternion3D<T>) -> Transform3D<T>
pub fn with_rotation(q: Quaternion3D<T>) -> Transform3D<T>
Returns a new transformation matrix for a counter-clockwise rotation with the given angle radians around the given vector. The given vector does not have to be a unit vector. If it is not a unit vector, this function will normalize and and multiply the angle with the original norm.
Sourcepub fn translate(self, tx: T, ty: T, tz: T) -> Transform3D<T>
pub fn translate(self, tx: T, ty: T, tz: T) -> Transform3D<T>
Translates the given transformation matrix with the given offsets by concatenating the given matrix to a new translation matrix.
Sourcepub fn scale(self, sx: T, sy: T, sz: T) -> Transform3D<T>
pub fn scale(self, sx: T, sy: T, sz: T) -> Transform3D<T>
Scales the given transformation matrix with the given factors by concatenating the given matrix to a new scale matrix.
Sourcepub fn rotate(self, q: Quaternion3D<T>) -> Transform3D<T>
pub fn rotate(self, q: Quaternion3D<T>) -> Transform3D<T>
Rotates the given transformation matrix with the given angle in radians around the given vector. The rotation is counter-clockwise and if the given vector is not unit, it will be normalized and the angle will be multiplied with the length of the original vector.
Sourcepub fn concat(self, other: Transform3D<T>) -> Transform3D<T>
pub fn concat(self, other: Transform3D<T>) -> Transform3D<T>
Concatenates the given transformation matrix to the current transformation matrix.
Sourcepub fn apply(self, point: Point3D<T>) -> Point3D<T>
pub fn apply(self, point: Point3D<T>) -> Point3D<T>
Applies the given transformation matrix to a point.
Sourcepub fn multiply_scalar(self, scalar: T) -> Transform3D<T>
pub fn multiply_scalar(self, scalar: T) -> Transform3D<T>
Multiplies every element of this transformation with the given scalar and returns the result.
Trait Implementations§
Source§impl<T> Clone for Transform3D<T>where
T: Clone,
impl<T> Clone for Transform3D<T>where
T: Clone,
Source§fn clone(&self) -> Transform3D<T>
fn clone(&self) -> Transform3D<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T> Debug for Transform3D<T>where
T: Debug,
impl<T> Debug for Transform3D<T>where
T: Debug,
Source§impl<T> Default for Transform3D<T>where
T: Float,
impl<T> Default for Transform3D<T>where
T: Float,
Source§fn default() -> Transform3D<T>
fn default() -> Transform3D<T>
Source§impl<T> PartialEq for Transform3D<T>where
T: Float,
impl<T> PartialEq for Transform3D<T>where
T: Float,
Source§impl<T> ToTokens for Transform3D<T>
impl<T> ToTokens for Transform3D<T>
Source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
impl<T> Copy for Transform3D<T>where
T: Copy,
impl<T> Eq for Transform3D<T>where
T: Float,
Auto Trait Implementations§
impl<T> Freeze for Transform3D<T>where
T: Freeze,
impl<T> RefUnwindSafe for Transform3D<T>where
T: RefUnwindSafe,
impl<T> Send for Transform3D<T>where
T: Send,
impl<T> Sync for Transform3D<T>where
T: Sync,
impl<T> Unpin for Transform3D<T>where
T: Unpin,
impl<T> UnwindSafe for Transform3D<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
Source§fn convert_into(self) -> U
fn convert_into(self) -> U
Source§fn convert_unclamped_into(self) -> U
fn convert_unclamped_into(self) -> U
Source§fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains the unclamped color. Read more