#include <deque>
#include <cstdio>
+using std::deque;
+using std::list;
+using std::vector;
+
/* A skyline is a sequence of non-overlapping buildings: something like
this:
_______
Alert to these considerations, we now accept buildings of zero-width.
*/
-ADD_SMOB_INIT (Skyline);
-
static void
print_buildings (list<Building> const &b)
{
// too steep to be stored in slope-intercept form, given round-off error
{
slope_ = 0.0;
- y_intercept_ = max (start_height, end_height);
+ y_intercept_ = std::max (start_height, end_height);
}
else
y_intercept_ = start_height - slope_ * start;
}
/* 'c' continues further, so move it into 'b' for the next pass. */
b = c;
- swap (sb, sc);
+ std::swap (sb, sc);
}
else /* b.end_ > c.end_ so finish with c */
{
Offset left = seg[LEFT];
Offset right = seg[RIGHT];
if (left[horizon_axis] > right[horizon_axis])
- swap (left, right);
+ std::swap (left, right);
Real x1 = left[horizon_axis];
Real x2 = right[horizon_axis];
Real touch = -infinity_f;
while (i != buildings_.end () && j != other.buildings_.end ())
{
- Real end = min (i->end_, j->end_);
+ Real end = std::min (i->end_, j->end_);
Real start_dist = i->height (start) + j->height (start);
Real end_dist = i->height (end) + j->height (end);
- dist = max (dist, max (start_dist, end_dist));
+ dist = std::max (dist, std::max (start_dist, end_dist));
if (end_dist == dist)
touch = end;
list<Building>::const_iterator i;
for (i = buildings_.begin (); i != buildings_.end (); ++i)
{
- ret = max (ret, i->height (i->start_));
- ret = max (ret, i->height (i->end_));
+ ret = std::max (ret, i->height (i->start_));
+ ret = std::max (ret, i->height (i->end_));
}
return sky_ * ret;
horizon_padding = scm_to_double (horizon_padding_scm);
}
- Skyline *skyline = Skyline::unsmob (skyline_scm);
- Skyline *other_skyline = Skyline::unsmob (other_skyline_scm);
+ Skyline *skyline = unsmob<Skyline> (skyline_scm);
+ Skyline *other_skyline = unsmob<Skyline> (other_skyline_scm);
return scm_from_double (skyline->touching_point (*other_skyline, horizon_padding));
}
horizon_padding = scm_to_double (horizon_padding_scm);
}
- Skyline *skyline = Skyline::unsmob (skyline_scm);
- Skyline *other_skyline = Skyline::unsmob (other_skyline_scm);
+ Skyline *skyline = unsmob<Skyline> (skyline_scm);
+ Skyline *other_skyline = unsmob<Skyline> (other_skyline_scm);
return scm_from_double (skyline->distance (*other_skyline, horizon_padding));
}
SCM
Skyline::get_max_height (SCM skyline_scm)
{
- return scm_from_double (Skyline::unsmob (skyline_scm)->max_height ());
+ return scm_from_double (unsmob<Skyline> (skyline_scm)->max_height ());
}
MAKE_SCHEME_CALLBACK (Skyline, get_max_height_position, 1)
SCM
Skyline::get_max_height_position (SCM skyline_scm)
{
- return scm_from_double (Skyline::unsmob (skyline_scm)->max_height_position ());
+ return scm_from_double (unsmob<Skyline> (skyline_scm)->max_height_position ());
}
MAKE_SCHEME_CALLBACK (Skyline, get_height, 2)
Skyline::get_height (SCM skyline_scm, SCM x_scm)
{
Real x = robust_scm2double (x_scm, 0.0);
- return scm_from_double (Skyline::unsmob (skyline_scm)->height (x));
+ return scm_from_double (unsmob<Skyline> (skyline_scm)->height (x));
}
LY_DEFINE (ly_skyline_empty_p, "ly:skyline-empty?",
1, 0, 0, (SCM sky),
"Return whether @var{sky} is empty.")
{
- Skyline *s = Skyline::unsmob (sky);
+ Skyline *s = unsmob<Skyline> (sky);
LY_ASSERT_SMOB (Skyline, sky, 1);
return scm_from_bool (s->is_empty ());
}