Region.opBinaryRight

Computes the intersection of the two regions.

  1. Region opBinaryRight(TaggedInterval other)
  2. Region opBinaryRight(TaggedInterval other)
    struct Region(Number, Tag, string tagAlias = null, Tag emptyTag = Tag.init)
    const
    opBinaryRight
    (
    string op
    )
    if (
    op == "&"
    )
  3. bool opBinaryRight(TaggedPoint point)

Examples

alias R = Region!(int, int);
alias TI = R.TaggedInterval;

assert((R(0, 10, 20) & R(0, 0, 5)) == R([]));
assert((R(0, 10, 20) & R(0, 5, 15)) == R(0, 10, 15));
assert((R(0, 10, 20) & R(0, 12, 18)) == R(0, 12, 18));
assert((R(0, 10, 20) & R(0, 10, 20)) == R(0, 10, 20));
assert((R(0, 10, 20) & R(0, 15, 25)) == R(0, 15, 20));
assert((R(0, 10, 20) & R(0, 25, 30)) == R([]));
assert((R(0, 10, 20) & R(1, 25, 30)) == R([]));
// R1:       [-------)   [-------)   [-------)
// R2:             [-------)   [-------)   [-------)
// R1 & R2:        [-)   [-)   [-)   [-)   [-)
assert((R([
    TI(0, 0, 30),
    TI(0, 40, 70),
    TI(0, 80, 110),
]) & R([
    TI(0, 20, 50),
    TI(0, 60, 90),
    TI(0, 100, 130),
])) == R([
    TI(0, 20, 30),
    TI(0, 40, 50),
    TI(0, 60, 70),
    TI(0, 80, 90),
    TI(0, 100, 110),
]));

Meta