[][src]Struct vek::geom::repr_simd::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.

Implementations

impl<T: Real + Add<T, Output = T>> 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: Clone> Clone for Ray<T>[src]

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

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

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

impl<'de, T> Deserialize<'de> for Ray<T> where
    T: Deserialize<'de>, 
[src]

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

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

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

impl<T> Serialize for Ray<T> where
    T: Serialize
[src]

impl<T> StructuralEq for Ray<T>[src]

impl<T> StructuralPartialEq for Ray<T>[src]

Auto Trait Implementations

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

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

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

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

impl<T> UnwindSafe for Ray<T> 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> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[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.