summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f4e9c95)
raw | patch | inline | side by side (parent: f4e9c95)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sat, 14 Jun 2008 15:57:11 +0000 (15:57 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sat, 14 Jun 2008 15:57:11 +0000 (15:57 +0000) |
src/2geom/interval.h | patch | blob | history |
diff --git a/src/2geom/interval.h b/src/2geom/interval.h
index c9e6703f5c52cb18ef067d2c7d1592a7b08b45f3..eb506dc1f060fff14f730e1d00de49e381a112e0 100644 (file)
--- a/src/2geom/interval.h
+++ b/src/2geom/interval.h
//
class Interval {
private:
- Coord _b[2];
+ Coord _b[2]; // this should always hold: _b[0] <= _b[1], otherwise the interval is empty.
public:
//TODO: I just know this'll pop up somewhere, starting off someone's interval at 0... I can't see how to avoid this.
inline Coord extent() const { return _b[1] - _b[0]; }
inline Coord middle() const { return (_b[1] + _b[0]) * 0.5; }
- inline bool isEmpty() const { return _b[0] == _b[1]; }
+ inline bool isEmpty() const { return _b[0] >= _b[1]; }
inline bool contains(Coord val) const { return _b[0] <= val && val <= _b[1]; }
bool contains(const Interval & val) const { return _b[0] <= val._b[0] && val._b[1] <= _b[1]; }
bool intersects(const Interval & val) const {