Trait glamour::traits::Intersection
source · pub trait Intersection<T = Self> {
type Intersection;
// Required methods
fn intersects(&self, thing: &T) -> bool;
fn intersection(&self, thing: &T) -> Option<Self::Intersection>;
}
Expand description
The intersection()
method.
Coordinates exactly on the upper bound are not considered to be intersecting.
For example, each adjacent tile of a grid of crate::Rect
s or
crate::Box2
s will not be considered intersecting, while
Contains::contains()
returns true for both tiles with coordinates that
fall exactly on the upper bound of one tile.
See also: Contains
, which is different in this regard.
Required Associated Types§
sourcetype Intersection
type Intersection
The type of intersection.
For example, a rect/rect intersection is another rect, while a box/box intersection is a box, and a rect/box intersection is a rect, but a box/rect intersection is a box.
Required Methods§
sourcefn intersects(&self, thing: &T) -> bool
fn intersects(&self, thing: &T) -> bool
True if thing
intersects with self
.
sourcefn intersection(&self, thing: &T) -> Option<Self::Intersection>
fn intersection(&self, thing: &T) -> Option<Self::Intersection>
If thing
intersects with self
, return the intersection. Otherwise,
returns None
.