summaryrefslogtreecommitdiffstats
path: root/src/libnr/nr-rect.h
diff options
context:
space:
mode:
authorMenTaLguY <mental@rydia.net>2007-03-11 21:41:42 +0000
committermental <mental@users.sourceforge.net>2007-03-11 21:41:42 +0000
commit7146a6c31b8507c9dfba86d3e91fa8c42e955e06 (patch)
tree8b2af16f2ed3611f9ac3ec26dfcd34694ed974ed /src/libnr/nr-rect.h
parentEliminate remaining sources of empty NR::Rects (diff)
downloadinkscape-7146a6c31b8507c9dfba86d3e91fa8c42e955e06.tar.gz
inkscape-7146a6c31b8507c9dfba86d3e91fa8c42e955e06.zip
ban empty rectangles entirely and remove isEmpty test
(bzr r2606)
Diffstat (limited to 'src/libnr/nr-rect.h')
-rw-r--r--src/libnr/nr-rect.h20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/libnr/nr-rect.h b/src/libnr/nr-rect.h
index b632261aa..6ae1e4e99 100644
--- a/src/libnr/nr-rect.h
+++ b/src/libnr/nr-rect.h
@@ -28,12 +28,16 @@
namespace NR {
struct Matrix;
+class EmptyRectangle : public std::logic_error {
+public:
+ EmptyRectangle() : logic_error("Attempt to create empty rectangle") {}
+};
+
/** A rectangle is always aligned to the X and Y axis. This means it
* can be defined using only 4 coordinates, and determining
* intersection is very efficient. The points inside a rectangle are
- * min[dim] <= _pt[dim] <= max[dim]. Emptiness, however, is defined
- * as having zero area, meaning an empty rectangle may still contain
- * points. Infinities are also permitted. */
+ * min[dim] <= _pt[dim] <= max[dim]. Emptiness, in the sense of having
+ * a zero area, is not permitted. Infinities are, however. */
class Rect {
public:
Rect() : _min(-_inf(), -_inf()), _max(_inf(), _inf()) {}
@@ -52,11 +56,6 @@ public:
/** returns the midpoint of this rect. */
Point midpoint() const;
- /** does this rectangle have zero area? */
- bool isEmpty() const {
- return isEmpty<X>() || isEmpty<Y>();
- }
-
bool intersects(Rect const &r) const {
return intersects<X>(r) && intersects<Y>(r);
}
@@ -154,11 +153,6 @@ private:
}
template <Dim2 axis>
- bool isEmpty() const {
- return !( _min[axis] < _max[axis] );
- }
-
- template <Dim2 axis>
bool intersects(Rect const &r) const {
return _max[axis] >= r._min[axis] && _min[axis] <= r._max[axis];
}