[][src]Struct polyhorn_ui::linalg::Transform3D

pub struct Transform3D<T> {
    pub columns: [[T; 4]; 4],
}

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

impl<T> Transform3D<T>[src]

pub fn new(columns: [[T; 4]; 4]) -> Transform3D<T>[src]

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.

pub fn map<F, O>(self, op: F) -> Transform3D<O> where
    F: FnMut(T) -> O, 
[src]

Applies the given transformation to each entry in the transformation matrix individually.

impl<T> Transform3D<T> where
    T: Float
[src]

pub fn identity() -> Transform3D<T>[src]

Returns a new identity matrix, i.e. a matrix of zeros with ones on the diagonal.

pub fn with_perspective(d: T) -> Transform3D<T>[src]

Returns a new transformation matrix for a perspective with the given depth.

pub fn with_translation(tx: T, ty: T, tz: T) -> Transform3D<T>[src]

Returns a new transformation matrix for a translation with the given offsets.

pub fn with_scale(sx: T, sy: T, sz: T) -> Transform3D<T>[src]

Returns a new transformation matrix for a scale with the given factors.

pub fn with_skew_x(sx: T) -> Transform3D<T>[src]

Returns a new transformation matrix for a horizontal skew with the given angle radians.

pub fn with_skew_y(sy: T) -> Transform3D<T>[src]

Returns a new transformation matrix for a vertical skew with the given angle radians.

pub fn with_rotation(q: Quaternion3D<T>) -> Transform3D<T>[src]

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.

pub fn translate(self, tx: T, ty: T, tz: T) -> Transform3D<T>[src]

Translates the given transformation matrix with the given offsets by concatenating the given matrix to a new translation matrix.

pub fn scale(self, sx: T, sy: T, sz: T) -> Transform3D<T>[src]

Scales the given transformation matrix with the given factors by concatenating the given matrix to a new scale matrix.

pub fn rotate(self, q: Quaternion3D<T>) -> Transform3D<T>[src]

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.

pub fn concat(self, other: Transform3D<T>) -> Transform3D<T>[src]

Concatenates the given transformation matrix to the current transformation matrix.

pub fn apply(self, point: Point3D<T>) -> Point3D<T>[src]

Applies the given transformation matrix to a point.

pub fn multiply_scalar(self, scalar: T) -> Transform3D<T>[src]

Multiplies every element of this transformation with the given scalar and returns the result.

Trait Implementations

impl<T: Clone> Clone for Transform3D<T>[src]

impl<T: Copy> Copy for Transform3D<T>[src]

impl<T: Debug> Debug for Transform3D<T>[src]

impl<T> Default for Transform3D<T> where
    T: Float
[src]

impl<T> Eq for Transform3D<T> where
    T: Float
[src]

impl<T> PartialEq<Transform3D<T>> for Transform3D<T> where
    T: Float
[src]

Auto Trait Implementations

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

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    D: AdaptFrom<S, Swp, Dwp, T>,
    Dwp: WhitePoint,
    Swp: WhitePoint,
    T: Component + Float
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> ConvertInto<U> for T where
    U: ConvertFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.