pub struct Ray<T, const N: usize> {
pub origin: Vector<T, N>,
pub direction: Vector<T, N>,
}Expand description
A ray with an origin and a direction. The direction is normalised.
Fields§
§origin: Vector<T, N>§direction: Vector<T, N>Implementations§
Source§impl<T, const N: usize> Ray<T, N>
impl<T, const N: usize> Ray<T, N>
Sourcepub fn new(origin: Vector<T, N>, direction: Vector<T, N>) -> Self
pub fn new(origin: Vector<T, N>, direction: Vector<T, N>) -> Self
Constructs a ray from an origin and direction. The given direction is normalised by the callee.
Sourcepub unsafe fn new_unchecked(
origin: Vector<T, N>,
direction: Vector<T, N>,
) -> Self
pub unsafe fn new_unchecked( origin: Vector<T, N>, direction: Vector<T, N>, ) -> Self
Constructs a ray from an origin and direction.
§Safety
The caller must ensure that the direction vector is normalised.
Sourcepub fn at(&self, t: T) -> Vector<T, N>
pub fn at(&self, t: T) -> Vector<T, N>
Evaluates this ray at t.
In the case of non-negative t, ray.at(t) is the point that is t units away from the ray’s
origin, in the ray’s direction.
In the case of negative t, ray.at(t) is the point that is -t units away from the ray’s
origin, in the opposite direction to the ray’s direction.
Auto Trait Implementations§
impl<T, const N: usize> Freeze for Ray<T, N>where
T: Freeze,
impl<T, const N: usize> RefUnwindSafe for Ray<T, N>where
T: RefUnwindSafe,
impl<T, const N: usize> Send for Ray<T, N>where
T: Send,
impl<T, const N: usize> Sync for Ray<T, N>where
T: Sync,
impl<T, const N: usize> Unpin for Ray<T, N>where
T: Unpin,
impl<T, const N: usize> UnwindSafe for Ray<T, N>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more