[][src]Struct vek::geom::repr_c::Ray

pub struct Ray<T> {
    pub origin: Vec3<T>,
    pub direction: Vec3<T>,
}

3D ray, represented by a starting point and a normalized direction vector.

Fields

origin: Vec3<T>

The ray's starting point.

direction: Vec3<T>

The ray's direction. Methods expect it to be normalized.

Methods

impl<T: Real + Sum> Ray<T>[src]

pub fn new(origin: Vec3<T>, direction: Vec3<T>) -> Self[src]

Creates a Ray from a starting point and direction.

This doesn't check if direction is normalized, because either you know it is, or it isn't and maybe it doesn't matter for your use case.

pub fn triangle_intersection(&self, tri: [Vec3<T>; 3]) -> Option<T>[src]

Tests if this ray intersects the given triangle, returning the distance from the ray's origin along its direction where the intersection lies.

If the returned value is Some(x) where x < EPSILON, then you should assume there was a line intersection, NOT a ray intersection.

This uses the Möller–Trumbore intersection algorithm.

Trait Implementations

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

impl<T: PartialEq> PartialEq<Ray<T>> for Ray<T>[src]

impl<T: Eq> Eq for Ray<T>[src]

impl<T: Hash> Hash for Ray<T>[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

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

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

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T: Default> Default for Ray<T>[src]

Auto Trait Implementations

impl<T> Unpin for Ray<T> where
    T: Unpin

impl<T> Sync for Ray<T> where
    T: Sync

impl<T> Send for Ray<T> where
    T: Send

impl<T> UnwindSafe for Ray<T> where
    T: UnwindSafe

impl<T> RefUnwindSafe for Ray<T> where
    T: RefUnwindSafe

Blanket Implementations

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> Into<U> for T where
    U: From<T>, 
[src]

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

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.