void
Building::precompute ()
{
- slope_ = (height_[RIGHT] - height_[LEFT]) / (iv_.length());
+ slope_ = (height_[RIGHT] - height_[LEFT]) / (iv_.length ());
if (height_[LEFT] == height_[RIGHT]) /* in case they're both infinity */
slope_ = 0;
while (!buildings->empty ())
partials.push_back (non_overlapping_skyline (buildings));
- /* we'd like to say while (partials->size () > 1) but that's O(n).
+ /* we'd like to say while (partials->size () > 1) but that's O (n).
Instead, we exit in the middle of the loop */
while (!partials.empty ())
{
return out;
}
+bool
+Skyline::is_empty () const
+{
+ return buildings_.empty ();
+}
+
Skyline_pair::Skyline_pair ()
: skylines_ (Skyline (DOWN), Skyline (UP))
{
skylines_[DOWN].merge (other[DOWN]);
}
+bool
+Skyline_pair::is_empty () const
+{
+ return skylines_[UP].is_empty ()
+ && skylines_[DOWN].is_empty ();
+}
+
Skyline&
Skyline_pair::operator [] (Direction d)
{
SCM
Skyline::mark_smob (SCM)
{
- ASSERT_LIVE_IS_ALLOWED();
+ ASSERT_LIVE_IS_ALLOWED ();
return SCM_EOL;
}