+ /*
+ We extract boxes from the skyline, then build a new skyline from
+ the boxes.
+ A box is created for every horizontal portion of the skyline
+ Because skylines are defined positive, and then inverted if they
+ are to be down-facing, we create the new skyline in the UP
+ direction, then give it the down direction if needed.
+ */
+ Real start = -infinity_f;
+ list<Box> boxes;
+
+ // establish a baseline box
+ boxes.push_back (Box (Interval (-infinity_f, infinity_f),
+ Interval (0, 0)));
+ list<Building>::const_iterator end = src.buildings_.end ();
+ for (list<Building>::const_iterator i = src.buildings_.begin (); i != end; start=i->end_, i++ )
+ if ((i->slope_ == 0) && !isinf (i->y_intercept_))
+ boxes.push_back (Box (Interval (start, i->end_),
+ Interval (-infinity_f , i->y_intercept_)));
+ buildings_ = internal_build_skyline (&boxes, horizon_padding, X_AXIS, UP);
+ sky_ = src.sky_;
+}
+
+
+/*
+ build skyline from a set of boxes. If horizon_padding > 0, expand all the boxes
+ by that amount and add 45-degree sloped boxes to the edges of each box (of
+ width horizon_padding). That is, the total amount of horizontal expansion is
+ horizon_padding*4, half of which is sloped and half of which is flat.
+
+ Boxes should have fatness in the horizon_axis (after they are expanded by
+ horizon_padding), otherwise they are ignored.
+ */
+Skyline::Skyline (vector<Box> const &boxes, Real horizon_padding, Axis horizon_axis, Direction sky)
+{
+ list<Box> filtered_boxes;