[−][src]Struct tray_rust::linalg::transform::Transform
Transform describes an affine transformation in 3D space and stores both the transformation and its inverse
Fields
mat: Matrix4
inv: Matrix4
Methods
impl Transform
[src]
pub fn identity() -> Transform
[src]
Construct the identity transformation
pub fn from_mat(mat: &Matrix4) -> Transform
[src]
Construct a transform from an existing matrix
pub fn from_pair(mat: &Matrix4, inv: &Matrix4) -> Transform
[src]
Construct a transform from an existing matrix/inverse pair
pub fn translate(v: &Vector) -> Transform
[src]
Construct a transformation matrix to translate by the vector
pub fn scale(v: &Vector) -> Transform
[src]
Construct a transform to scale x, y and z by the values in the vector
pub fn rotate_x(deg: f32) -> Transform
[src]
Construct a transform to rotate deg
degrees about the x axis
pub fn rotate_y(deg: f32) -> Transform
[src]
Construct a transform to rotate deg
degrees about the y axis
pub fn rotate_z(deg: f32) -> Transform
[src]
Construct a transform to rotate deg
degrees about the z axis
pub fn rotate(axis: &Vector, deg: f32) -> Transform
[src]
Construct a transform to rotate about axis
by deg
degrees
pub fn look_at(pos: &Point, center: &Point, up: &Vector) -> Transform
[src]
Construct the look at transform for a camera at pos
looking at
the point center
oriented with up vector up
pub fn perspective(fovy: f32, near: f32, far: f32) -> Transform
[src]
Construct a perspective transformation
pub fn inverse(&self) -> Transform
[src]
Return the inverse of the transformation
pub fn has_scale(&self) -> bool
[src]
Returns true if the transform has applies a scaling
pub fn inv_mul_point(&self, p: &Point) -> Point
[src]
Multiply the point by the inverse transformation TODO: These inverse mults are a bit hacky since Rust doesn't currently have function overloading, clean up when it's added
pub fn inv_mul_vector(&self, v: &Vector) -> Vector
[src]
Multiply the vector with the inverse transformation
pub fn inv_mul_normal(&self, n: &Normal) -> Normal
[src]
Multiply the normal with the inverse transformation
pub fn inv_mul_ray(&self, ray: &Ray) -> Ray
[src]
Multiply the ray with the inverse transformation
Trait Implementations
impl Clone for Transform
[src]
impl Copy for Transform
[src]
impl PartialEq<Transform> for Transform
[src]
impl Debug for Transform
[src]
impl Mul<Transform> for Transform
[src]
type Output = Transform
The resulting type after applying the *
operator.
fn mul(self, rhs: Transform) -> Transform
[src]
Compose two transformations
impl Mul<Point> for Transform
[src]
type Output = Point
The resulting type after applying the *
operator.
fn mul(self, p: Point) -> Point
[src]
Multiply the point by the transform to apply the transformation
impl Mul<Vector> for Transform
[src]
type Output = Vector
The resulting type after applying the *
operator.
fn mul(self, v: Vector) -> Vector
[src]
Multiply the vector by the transform to apply the transformation
impl Mul<Normal> for Transform
[src]
type Output = Normal
The resulting type after applying the *
operator.
fn mul(self, n: Normal) -> Normal
[src]
Multiply the normal by the transform to apply the transformation
impl Mul<Ray> for Transform
[src]
type Output = Ray
The resulting type after applying the *
operator.
fn mul(self, ray: Ray) -> Ray
[src]
Multiply the ray by the transform to apply the transformation
impl Mul<BBox> for Transform
[src]
type Output = BBox
The resulting type after applying the *
operator.
fn mul(self, b: BBox) -> BBox
[src]
Apply the transformation to the AABB. This is an implementation of Arvo (1990) AABB transformation
impl StructuralPartialEq for Transform
[src]
Auto Trait Implementations
impl Send for Transform
impl Sync for Transform
impl Unpin for Transform
impl UnwindSafe for Transform
impl RefUnwindSafe for Transform
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,