
Boost : 
From: Joel Young (jdy_at_[hidden])
Date: 20020904 13:07:04
Why try to map point based comparison operators onto intervals?
There are already well defined comparisons for intervalinterval
relations, intervalpoint relations, and pointinterval relations.
Use them (see my previous post).
intervalinterval
([a,a] is not intervalit 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
shareswith (meaning two intervals have some interval in common)
shareswith = {==, d, di, s, si, f, fi, o, oi}
!shareswith = {<, >, 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 intervalpoint and pointinterval 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