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.
Source§impl Ray
impl Ray
pub fn get_origin(&self) -> Vector3D
pub fn get_mut_origin(&mut self) -> &mut Vector3D
pub fn set_origin(&mut self, val: Vector3D) -> &mut Self
pub fn get_direction(&self) -> Vector3D
pub fn get_mut_direction(&mut self) -> &mut Vector3D
pub fn set_direction(&mut self, val: Vector3D) -> &mut Self
pub fn get_t_min(&self) -> f64
pub fn get_mut_t_min(&mut self) -> &mut f64
pub fn set_t_min(&mut self, val: f64) -> &mut Self
pub fn get_t_max(&self) -> f64
pub fn get_mut_t_max(&mut self) -> &mut f64
pub fn set_t_max(&mut self, val: f64) -> &mut Self
pub fn get_depth(&self) -> u32
pub fn get_mut_depth(&mut self) -> &mut u32
pub fn set_depth(&mut self, val: u32) -> &mut Self
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