[][src]Struct tray_rust::linalg::normal::Normal

pub struct Normal {
    pub x: f32,
    pub y: f32,
    pub z: f32,
}

Normal is a standard 3 component normal but transforms as a normal normal when transformations are applied

Fields

x: f32y: f32z: f32

Methods

impl Normal[src]

pub fn new(x: f32, y: f32, z: f32) -> Normal[src]

Initialize the normal and set values for x, y, z

pub fn broadcast(x: f32) -> Normal[src]

Initialize the normal with the same value of x, y, z

pub fn length_sqr(&self) -> f32[src]

Compute the squared length of the normal

pub fn length(&self) -> f32[src]

Compute the length of the normal

pub fn normalized(&self) -> Normal[src]

Get a normalized copy of this normal

pub fn face_forward(&self, v: &Vector) -> Normal[src]

Return a normal facing along the same direction as v

Trait Implementations

impl Clone for Normal[src]

impl Copy for Normal[src]

impl PartialEq<Normal> for Normal[src]

impl PartialOrd<Normal> for Normal[src]

impl Debug for Normal[src]

impl Div<Normal> for Normal[src]

type Output = Normal

The resulting type after applying the / operator.

fn div(self, rhs: Normal) -> Normal[src]

Divide the normals components by the right hand side's components

impl Div<f32> for Normal[src]

type Output = Normal

The resulting type after applying the / operator.

fn div(self, rhs: f32) -> Normal[src]

Divide the normals components by scalar

impl Sub<Normal> for Normal[src]

type Output = Normal

The resulting type after applying the - operator.

fn sub(self, rhs: Normal) -> Normal[src]

Subtract two normals

impl Add<Normal> for Normal[src]

type Output = Normal

The resulting type after applying the + operator.

fn add(self, rhs: Normal) -> Normal[src]

Add two normals together

impl Mul<Normal> for Normal[src]

type Output = Normal

The resulting type after applying the * operator.

fn mul(self, rhs: Normal) -> Normal[src]

Multiply two normals

impl Mul<f32> for Normal[src]

type Output = Normal

The resulting type after applying the * operator.

fn mul(self, rhs: f32) -> Normal[src]

Scale the normal by some value

impl Mul<Normal> for f32[src]

type Output = Normal

The resulting type after applying the * operator.

fn mul(self, rhs: Normal) -> Normal[src]

Scale the normal by some value

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 Neg for Normal[src]

type Output = Normal

The resulting type after applying the - operator.

fn neg(self) -> Normal[src]

Negate the normal

impl Index<usize> for Normal[src]

type Output = f32

The returned type after indexing.

fn index(&self, i: usize) -> &f32[src]

Access the normal by index

  • 0 = x
  • 1 = y
  • 2 = z

impl IndexMut<usize> for Normal[src]

fn index_mut(&mut self, i: usize) -> &mut f32[src]

Access the normal by index

  • 0 = x
  • 1 = y
  • 2 = z

impl StructuralPartialEq for Normal[src]

Auto Trait Implementations

impl Send for Normal

impl Sync for Normal

impl Unpin for Normal

impl UnwindSafe for Normal

impl RefUnwindSafe for Normal

Blanket Implementations

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

impl<T> From<T> for 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.

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

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

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

impl<T> Interpolate for T where
    T: Add<T, Output = T> + Mul<f32, Output = T> + Copy
[src]

impl<T> SetParameter for T[src]