Struct vek::geom::repr_c::Ray [−][src]
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]
T: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<T: Eq> Eq for Ray<T>
[src]
impl<T: Hash> Hash for Ray<T>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: PartialEq> PartialEq<Ray<T>> for Ray<T>
[src]
impl<T> Serialize for Ray<T> where
T: Serialize,
[src]
T: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
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,
[src]
T: RefUnwindSafe,
impl<T> Send for Ray<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for Ray<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for Ray<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for Ray<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,