pub struct Ray2 { /* private fields */ }Expand description
A 2D ray with a unit-length direction; distances are world units.
Implementations§
Source§impl Ray2
impl Ray2
Sourcepub fn new(origin: Vec2, direction: Vec2) -> Result<Self, SpatialError>
pub fn new(origin: Vec2, direction: Vec2) -> Result<Self, SpatialError>
Constructs a ray, normalizing its finite, nonzero direction.
Sourcepub fn cast(
self,
bounds: Aabb2,
max_distance: f32,
) -> Result<Option<RayHit2>, SpatialError>
pub fn cast( self, bounds: Aabb2, max_distance: f32, ) -> Result<Option<RayHit2>, SpatialError>
First box contact, inclusive of faces and max_distance.
Strict inside starts return distance zero and a zero normal.
A boundary start reports zero distance; an outward start uses
zero normal, while an inward start reports that face’s normal.
f32::INFINITY is accepted for an unbounded search.
Trait Implementations§
impl Copy for Ray2
impl StructuralPartialEq for Ray2
Auto Trait Implementations§
impl Freeze for Ray2
impl RefUnwindSafe for Ray2
impl Send for Ray2
impl Sync for Ray2
impl Unpin for Ray2
impl UnsafeUnpin for Ray2
impl UnwindSafe for Ray2
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