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::Rects or crate::Box2s 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§

source

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§

source

fn intersects(&self, thing: &T) -> bool

True if thing intersects with self.

source

fn intersection(&self, thing: &T) -> Option<Self::Intersection>

If thing intersects with self, return the intersection. Otherwise, returns None.

Implementors§