pub struct Ray { /* private fields */ }Expand description
A 3D ray carrying the parameters needed for traversal and depth tracking.
Implementations§
Source§impl Ray
impl Ray
Sourcepub fn with_depth(&self, depth: u32) -> Ray
pub fn with_depth(&self, depth: u32) -> Ray
Sourcepub fn intersect_triangle(
&self,
v0: Vector3D,
v1: Vector3D,
v2: Vector3D,
) -> Option<(f64, Vector3D)>
pub fn intersect_triangle( &self, v0: Vector3D, v1: Vector3D, v2: Vector3D, ) -> Option<(f64, Vector3D)>
Intersects this ray with the triangle v0, v1, v2 using the
Moller-Trumbore algorithm, keeping only hits inside this ray’s
t_min..=t_max range.
The test is two-sided: a hit from either face counts, and the returned normal always faces against the ray direction.
§Arguments
Vector3D- The first triangle vertex.Vector3D- The second triangle vertex.Vector3D- The third triangle vertex.
§Returns
Option<(f64, Vector3D)>- The hit distance along the ray and the unit normal oriented against the ray direction, orNoneon miss.
Trait Implementations§
impl StructuralPartialEq for Ray
Auto Trait Implementations§
impl Freeze for Ray
impl RefUnwindSafe for Ray
impl Send for Ray
impl Sync for Ray
impl Unpin for Ray
impl UnsafeUnpin for Ray
impl UnwindSafe for Ray
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