Boost logo

Boost :

From: Joel Young (jdy_at_[hidden])
Date: 2002-09-04 13:07:04


Why try to map point based comparison operators onto intervals?

There are already well defined comparisons for interval-interval
relations, interval-point relations, and point-interval relations.

Use them (see my previous post).

interval-interval
([a,a] is not interval--it is a point,
 [a,b] is an interval iff a < b)

 equals:
 [a,b] == [c,d] iff a == c .and. b == d

 less than, aka precedes, aka <:
 [a,b] < [c,d] iff b < c
 greater than, aka follows, aka >:
 [a,b] > [c,d] iff d < a

 meets, aka m:
 [a,b] m [c,d] iff b == c
 met by, aka mi:
 [a,b] mi [c,d] iff d == a

 overlaps, aka o:
 [a,b] o [c,d] iff (a < c) .and. (c < b < d)
 overlapped by, aka oi:
 [a,b] oi [c,d] iff (c < a) .and. (a < d < b)

 starts, aka s:
 [a,b] s [c,d] iff (a == c) .and. (b < d)
 started by, aka si:
 [a,b] si [c,d] iff (a == c) .and. (d < b)

 during, aka d:
 [a,b] d [c,d] iff (a > c) .and. (a < d < b)
 contains, aka di:
 [a,b] di [c,d] iff (c > a) .and. (c < b < d)

 finishes, aka f:
 [a,b] f [c,d] iff (b == d) .and. (a > c)
 finish by, aka fi:
 [a,b] fi [c,d] iff (b == d) .and. (c > a)

Since these relations are mutually exclusive for intervals, and these
thirteen relations are exhaustive we define a universe A which is the
set of all these relations.

A = {==, <, >, m, mi, o, oi, s, si, d, di, f, fi}

Then we can say for all intervals B and C
B A C

Then the meaning of "not" becomes clear. if we say not(B < C) what we
mean is (B (A-{<}) C)

we can name these sets of relations. For example

shares-with (meaning two intervals have some interval in common)

shares-with = {==, d, di, s, si, f, fi, o, oi}
!shares-with = {<, >, m, mi}

by the way, (sorry for the TeX but I am lazy)

  A set $\cR$ of interval relations is said to be \emph{monotonic} if
  and only if for all $R$ in $\cR$, $\overline{R}^c \cap
  ({\overline{R}^c})^{-1} = \emptyset$ where $\overline{R} = \cup_{R \in
  \cR} R$ and $\overline{R}^c$ is the transitive closure of $R$ and
  ${\overline{R}^c}^{-1}$ is the inverse of the transitive closure of
  $R$.

an example monotonic set is:
{<, o, s, fi, di, m}

I submit that an interval class should have these relations defined.
Also, the interval-point and point-interval relations should also be
defined.

Joel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk