+/*
+ build padded skyline from an existing skyline with padding
+ added to it.
+*/
+
+Skyline::Skyline (Skyline const &src, Real horizon_padding, Axis a)
+{
+ /*
+ 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_;
+}
+
+