- if (s2->front ().conceals (s1->front (), x))
- swap (s1, s2);
-
- Building b = s1->front ();
- Building c = s2->front ();
-
- // Optimization: if the other skyline is empty at this point,
- // we can avoid testing some intersections. Just grab as many
- // buildings from s1 as we can, and shove them onto the output.
- if (c.y_intercept_ == -infinity_f
- && c.end_ >= b.end_)
- {
- list<Building>::iterator i = s1->begin ();
- i++;
- while (i != s1->end () && i->end_ <= c.end_)
- i++;
-
- s1->front ().start_ = x;
- result->splice (result->end (), *s1, s1->begin (), i);
- x = result->back ().end_;
- last_end = x;
- continue;
- }
-
- Real end = first_intersection (b, s2, x);
- if (s2->empty ())
+ /* Building b is continuing from the previous pass through the loop.
+ Building c is newly-considered, and starts no earlier than b started.
+ The comments draw b as if its roof had zero slope ----.
+ with dashes where b lies above c.
+ The roof of c could rise / or fall \ through the roof of b,
+ or the vertical sides | of c could intersect the roof of b. */
+ Building c = sc->front ();
+ if (b.end_ < c.end_) /* finish with b */