pub struct Ray {
pub o: Vect,
pub v: Vect,
}
Fields§
§o: Vect
§v: Vect
Implementations§
Source§impl Ray
impl Ray
pub fn new(ox: f32, oy: f32, vx: f32, vy: f32) -> Self
Sourcepub fn from_points(a: Vect, b: Vect) -> Self
pub fn from_points(a: Vect, b: Vect) -> Self
ray can be also expressed as line from a to b
Sourcepub fn is_on(&self, pos: Vect) -> bool
pub fn is_on(&self, pos: Vect) -> bool
returns whether point belongs to the INFINITE LINE Ray expresses
Sourcepub fn within(&self, pos: Vect) -> bool
pub fn within(&self, pos: Vect) -> bool
returns whether point in in AABB this raycast expresses
Sourcepub fn contains(&self, pos: Vect) -> bool
pub fn contains(&self, pos: Vect) -> bool
combination of within and is_on, if it returns true point belongs to a Ray
Sourcepub fn prj_x(&self, x: f32) -> f32
pub fn prj_x(&self, x: f32) -> f32
projects x coordinate to y coordinate. This is mainly an helper for intersection calculations
pub fn project_to_grid(&self, grid_resolution: Vect) -> Self
Trait Implementations§
Source§impl Intersection<Circ> for Ray
impl Intersection<Circ> for Ray
fn intersects(&self, o: &Circ) -> bool
Source§impl Intersection<Ray> for Circ
impl Intersection<Ray> for Circ
fn intersects(&self, o: &Ray) -> bool
Source§impl Intersection<Ray> for Ray
impl Intersection<Ray> for Ray
fn intersects(&self, o: &Ray) -> bool
Source§impl Intersection<Ray> for Rect
impl Intersection<Ray> for Rect
Source§fn intersects(&self, o: &Ray) -> bool
fn intersects(&self, o: &Ray) -> bool
returns whether rectangle intersects ray
Source§impl Intersection<Rect> for Ray
impl Intersection<Rect> for Ray
fn intersects(&self, o: &Rect) -> bool
Source§impl IntersectionPoints<Circ> for Ray
impl IntersectionPoints<Circ> for Ray
Source§impl IntersectionPoints<Ray> for Circ
impl IntersectionPoints<Ray> for Circ
Source§impl IntersectionPoints<Ray> for Ray
impl IntersectionPoints<Ray> for Ray
Source§impl IntersectionPoints<Ray> for Rect
impl IntersectionPoints<Ray> for Rect
Source§impl IntersectionPoints<Rect> for Ray
impl IntersectionPoints<Rect> for Ray
impl Copy 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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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