Function Region2D.containsRelative

Tests whether relative fits inside this region when relative.x and relative.y are interpreted relative to this region's origin.

bool containsRelative(
  Region2D relative
) pure nothrow @nogc @safe const;

Subtraction-based containment avoids overflow from expressions such as relative.x + relative.width.

Example

Example testing a child region relative to its parent.

import raster;

const parent = Region2D(100, 200, 8, 6);
assert(parent.containsRelative(Region2D(2, 1, 3, 4)));
assert(!parent.containsRelative(Region2D(7, 0, 2, 1)));