Enum zng_unit::Orientation2D
source · 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: PxPoint, point: PxPoint) -> bool
pub fn point_is(self, origin: PxPoint, point: PxPoint) -> 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: PxBox, b: PxBox) -> bool
pub fn box_is(self, origin: PxBox, b: PxBox) -> 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: PxPoint,
max_distance: Px,
spatial_bounds: PxBox,
) -> impl Iterator<Item = PxBox>
pub fn search_bounds( self, origin: PxPoint, max_distance: Px, spatial_bounds: PxBox, ) -> impl Iterator<Item = PxBox>
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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for Orientation2D
impl PartialEq for Orientation2D
source§impl Serialize for Orientation2D
impl Serialize for Orientation2D
impl Copy for Orientation2D
impl Eq 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> 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
)