[][src]Struct quick_maths::Transform

pub struct Transform<T, const N: usize> {
    pub fwd: Matrix<N, N, T>,
    pub bkwd: Matrix<N, N, T>,
}

Transform type which represents an easily invertible operator. i.e. rotation in 3D, translation, etc.

Fields

fwd: Matrix<N, N, T>

Forward transformation

bkwd: Matrix<N, N, T>

Inverted transformation

Implementations

impl<T: Float, const N: usize> Transform<T, N>[src]

pub fn identity() -> Self[src]

pub fn inv(&self) -> Self[src]

impl<T: Float> Transform<T, 4_usize>[src]

pub fn new(m: Mat4<T>) -> Self[src]

pub fn scale(by: Vec3<T>) -> Self[src]

pub fn rot(axis: Vec3<T>, theta: T) -> Self[src]

pub fn translate(by: Vec3<T>) -> Self[src]

pub fn orthographic(z_near: T, z_far: T) -> Self[src]

pub fn perspective(fov: T, near: T, far: T) -> Self[src]

Perspective transformation

pub fn look_at(pos: Vec3<T>, at: Vec3<T>, up: Vec3<T>) -> Self[src]

A transformation that orients something as if it's looking towards "at" from "pos".

pub fn apply_point(&self, pt: &Vec3<T>) -> Vec3<T>[src]

Applies this transformation as if to a point.

pub fn apply_vec(&self, vec: &Vec3<T>) -> Vec3<T>[src]

Applies this transformation as if applying it to a vector What this means operationally is no transformations.

pub fn apply_normal(&self, n: &Vec3<T>) -> Vec3<T>[src]

Applies this transformation as if applying it to a (surface) normal vector

pub fn apply_ray(&self, r: &Ray3<T>) -> Ray3<T>[src]

Applies this transform to a ray (convenience for applying point to origin and vector to direction)

impl<T: Float> Transform<T, 3_usize>[src]

pub fn scale(by: Vec2<T>) -> Self[src]

pub fn rot(theta: T) -> Self[src]

pub fn translate(by: Vec2<T>) -> Self[src]

pub fn apply_point(&self, v: Vec2<T>) -> Vec2<T>[src]

Trait Implementations

impl<T: Clone, const N: usize> Clone for Transform<T, N>[src]

impl<T: Copy, const N: usize> Copy for Transform<T, N>[src]

impl<T: Debug, const N: usize> Debug for Transform<T, N>[src]

impl<T: Eq, const N: usize> Eq for Transform<T, N>[src]

impl<T: Float, const N: usize> Mul<Transform<T, N>> for Transform<T, N>[src]

type Output = Self

The resulting type after applying the * operator.

impl<T: PartialEq, const N: usize> PartialEq<Transform<T, N>> for Transform<T, N>[src]

impl<T, const N: usize> StructuralEq for Transform<T, N>[src]

impl<T, const N: usize> StructuralPartialEq for Transform<T, N>[src]

Auto Trait Implementations

impl<T, const N: usize> RefUnwindSafe for Transform<T, N> where
    T: RefUnwindSafe

impl<T, const N: usize> Send for Transform<T, N> where
    T: Send

impl<T, const N: usize> Sync for Transform<T, N> where
    T: Sync

impl<T, const N: usize> Unpin for Transform<T, N> where
    T: Unpin

impl<T, const N: usize> UnwindSafe for Transform<T, N> where
    T: UnwindSafe

Blanket Implementations

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> 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.