[][src]Struct libraymarcher::Vec3

pub struct Vec3 {
    pub x: f64,
    pub y: f64,
    pub z: f64,
}

A 3 dimensional vector of f64

Fields

x: f64y: f64z: f64

Implementations

impl Vec3[src]

pub fn magnitude(self) -> f64[src]

The Euclidean norm

pub fn dot(self, other: Vec3) -> f64[src]

Dot product with another Vec3

pub fn normalized(self) -> Self[src]

Normalize this Vec3 so that it has a magnitude of 1

Will panic with a div by zero if the self.magnitude() is zero

pub fn reflect(self, norm: Vec3) -> Self[src]

Reflect this vector about a normal vec.

pub fn cross(self, other: Vec3) -> Self[src]

Cross product with another Vec3

pub fn refract(self, norm: Vec3, eta: f64) -> Self[src]

Simulate Snell's law refrection through a surface with normal vec.

eta is the relative index of refraction, ri1 / ri2

pub fn lerp(self, other: Vec3, t: f64) -> Self[src]

Linearly interpolate between two Vec3 with an interpolation value t

Trait Implementations

impl Add<Vec3> for Vec3[src]

type Output = Vec3

The resulting type after applying the + operator.

impl Add<f64> for Vec3[src]

type Output = Vec3

The resulting type after applying the + operator.

impl Clone for Vec3[src]

impl Color for Vec3[src]

impl Copy for Vec3[src]

impl Debug for Vec3[src]

impl Default for Vec3[src]

impl From<(f64, f64, f64)> for Vec3[src]

impl From<(i32, i32, i32)> for Vec3[src]

impl From<Vec3> for u32[src]

impl From<f64> for Vec3[src]

impl From<i32> for Vec3[src]

impl Mul<Vec3> for f64[src]

type Output = Vec3

The resulting type after applying the * operator.

impl Mul<f64> for Vec3[src]

type Output = Vec3

The resulting type after applying the * operator.

impl Neg for Vec3[src]

type Output = Vec3

The resulting type after applying the - operator.

impl PartialEq<Vec3> for Vec3[src]

impl StructuralPartialEq for Vec3[src]

impl Sub<Vec3> for Vec3[src]

type Output = Vec3

The resulting type after applying the - operator.

Auto Trait Implementations

impl RefUnwindSafe for Vec3

impl Send for Vec3

impl Sync for Vec3

impl Unpin for Vec3

impl UnwindSafe for Vec3

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.