pub struct Ray3 {
pub origin: Vec3,
pub direction: Vec3,
}Expand description
A 3D ray used for hit testing.
Fields§
§origin: Vec3§direction: Vec3Implementations§
Source§impl Ray3
impl Ray3
pub fn new(origin: Vec3, direction: Vec3) -> Self
pub fn at(&self, t: f32) -> Vec3
Sourcepub fn distance_to_point(&self, p: Vec3) -> f32
pub fn distance_to_point(&self, p: Vec3) -> f32
Closest distance from the ray to a point.
Sourcepub fn closest_t_to_segment(&self, a: Vec3, b: Vec3) -> f32
pub fn closest_t_to_segment(&self, a: Vec3, b: Vec3) -> f32
Closest t on the ray to a line segment (a, b).
Sourcepub fn distance_to_segment(&self, a: Vec3, b: Vec3) -> f32
pub fn distance_to_segment(&self, a: Vec3, b: Vec3) -> f32
Distance from ray to a line segment.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Ray3
impl RefUnwindSafe for Ray3
impl Send for Ray3
impl Sync for Ray3
impl Unpin for Ray3
impl UnsafeUnpin for Ray3
impl UnwindSafe for Ray3
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.