/*
interval.hh -- part of flowerlib
- (c) 1996--2004 Han-Wen Nienhuys
+ (c) 1996--2005 Han-Wen Nienhuys
*/
#ifndef INTERVAL_HH
#define INTERVAL_HH
-#include <assert.h>
#include "flower-proto.hh"
-#include "real.hh"
#include "drul-array.hh"
/* A T interval. This represents the closed interval [left,right].
elem_ref (RIGHT) += t;
}
+ T distance (T t) const
+ {
+ if (t > elem (RIGHT))
+ return T (t - elem (RIGHT));
+ else if (t < elem (LEFT))
+ return T (elem (LEFT) - t);
+ else
+ return T (0);
+ }
/**
PRE
*this and h are comparable