Boxes are not really "empty" just because they show negative
advancement on some axis. A box is empty if its original dimensions
of (+inf . -inf) are still unchanged for both axes. And boxes can
make an impact in one axis but not another (pretty much the definition
of spacing), so is_empty can take an axis as argument now.
bool
Box::is_empty () const
{
- return interval_a_[X_AXIS].is_empty ()
- || interval_a_[Y_AXIS].is_empty ();
+ return is_empty (X_AXIS) && is_empty (Y_AXIS);
+}
+
+bool
+Box::is_empty (Axis a) const
+{
+ Interval empty;
+ empty.set_empty ();
+ return interval_a_[a][LEFT] == empty[LEFT]
+ && interval_a_[a][RIGHT] == empty[RIGHT];
}
Box::Box (Interval ix, Interval iy)
Interval &operator [] (Axis a);
Real area () const;
bool is_empty () const;
+ bool is_empty (Axis a) const;
Offset center () const;