pub enum Orientation2D {
Above,
Right,
Below,
Left,
}
Expand description
Orientation of two 2D items.
Variants§
Above
Point is above the origin.
Right
Point is to the right of the origin.
Below
Point is below the origin.
Left
Point is to the left of the origin.
Implementations§
source§impl Orientation2D
impl Orientation2D
sourcepub fn point_is(self, origin: Point2D<Px, Px>, point: Point2D<Px, Px>) -> bool
pub fn point_is(self, origin: Point2D<Px, Px>, point: Point2D<Px, Px>) -> bool
Check if point
is orientation from origin
.
Returns true
if the point is hit by a 45º frustum cast from origin in the direction defined by the orientation.
sourcepub fn box_is(self, origin: Box2D<Px, Px>, b: Box2D<Px, Px>) -> bool
pub fn box_is(self, origin: Box2D<Px, Px>, b: Box2D<Px, Px>) -> bool
Check if b
is orientation from origin
.
Returns true
if the box b
collides with the box origin
in the direction defined by orientation. Also
returns true
if the boxes already overlap.
sourcepub fn search_bounds(
self,
origin: Point2D<Px, Px>,
max_distance: Px,
spatial_bounds: Box2D<Px, Px>,
) -> impl Iterator<Item = Box2D<Px, Px>>
pub fn search_bounds( self, origin: Point2D<Px, Px>, max_distance: Px, spatial_bounds: Box2D<Px, Px>, ) -> impl Iterator<Item = Box2D<Px, Px>>
Iterator that yields quadrants for efficient search in a quad-tree, if a point is inside a quadrant and
passes the Orientation2D::point_is
check it is in the orientation, them if it is within the max_distance
it is valid.
Trait Implementations§
source§impl Clone for Orientation2D
impl Clone for Orientation2D
source§fn clone(&self) -> Orientation2D
fn clone(&self) -> Orientation2D
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for Orientation2D
impl Debug for Orientation2D
source§impl<'de> Deserialize<'de> for Orientation2D
impl<'de> Deserialize<'de> for Orientation2D
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Orientation2D, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Orientation2D, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl IntoVar<Option<Orientation2D>> for Orientation2D
impl IntoVar<Option<Orientation2D>> for Orientation2D
source§type Var = LocalVar<Option<Orientation2D>>
type Var = LocalVar<Option<Orientation2D>>
Variable type that will wrap the
T
value. Read moresource§fn into_var(self) -> <Orientation2D as IntoVar<Option<Orientation2D>>>::Var
fn into_var(self) -> <Orientation2D as IntoVar<Option<Orientation2D>>>::Var
Converts the source value into a var.
source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
Converts into
BoxedVar<T>
. Read moresource§impl PartialEq for Orientation2D
impl PartialEq for Orientation2D
source§impl Serialize for Orientation2D
impl Serialize for Orientation2D
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for Orientation2D
impl Eq for Orientation2D
impl IntoValue<Option<Orientation2D>> for Orientation2D
impl StructuralPartialEq for Orientation2D
Auto Trait Implementations§
impl Freeze for Orientation2D
impl RefUnwindSafe for Orientation2D
impl Send for Orientation2D
impl Sync for Orientation2D
impl Unpin for Orientation2D
impl UnwindSafe for Orientation2D
Blanket Implementations§
source§impl<T> AnyVarValue for Twhere
T: VarValue,
impl<T> AnyVarValue for Twhere
T: VarValue,
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Access to mut
dyn Any
methods.source§fn clone_boxed(&self) -> Box<dyn AnyVarValue>
fn clone_boxed(&self) -> Box<dyn AnyVarValue>
Clone the value.
source§fn clone_boxed_var(&self) -> Box<dyn AnyVar>
fn clone_boxed_var(&self) -> Box<dyn AnyVar>
Clone the value into a new boxed
LocalVar<Self>
.source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
Gets if
self
equals other
.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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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