Function Bounds2.intersects

True when this closed bounds intersects other.

bool intersects(
  Bounds2 other
) const pure nothrow @nogc @safe;

Empty bounds never intersect.

Touching edges or corners count as intersection.

Example

Example showing that closed bounds intersect when they touch.

import geo;

alias P = Point2!int;
alias B = Bounds2!int;

B first;
B touching;
B separate;

assert(
    B.tryFromMinMax(
        P(0, 0),
        P(4, 4),
        first
    )
);

assert(
    B.tryFromMinMax(
        P(4, 2),
        P(7, 6),
        touching
    )
);

assert(
    B.tryFromMinMax(
        P(5, 2),
        P(7, 6),
        separate
    )
);

assert(first.intersects(touching));
assert(!first.intersects(separate));
assert(!first.intersects(B.init));