]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/skyline.hh
Add max_slopes_ to skylines (no more vertical walls)
[lilypond.git] / lily / include / skyline.hh
1 /*
2   skyline.hh -- declare Skyline class.
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2006 Joe Neeman <joeneeman@gmail.com>
7 */
8
9 #ifndef SKYLINE_HH
10 #define SKYLINE_HH
11
12 #include <list>
13 #include "axis.hh"
14 #include "box.hh"
15 #include "interval.hh"
16 #include "direction.hh"
17 #include "std-vector.hh"
18 #include "stencil.hh"
19
20 struct Building
21 {
22   Interval iv_;
23   Real start_height_;
24   Real end_height_;
25   Real m_;
26   Real b_;
27
28   Building (Real start, Real start_height, Real end_height, Real end, Real max_slope);
29
30   Real height (Real x) const;
31   Real intersection (Building const &other) const;
32   void leading_part (Real chop, Real h);
33   bool obstructs (Building const &other) const;
34 };
35
36 class Skyline
37 {
38 private:
39   list<Building> buildings_;
40   Direction sky_;
41   Real max_slope_;
42   void internal_merge_skyline (list<Building>*, list<Building>*,
43                                list<Building> *const result);
44   void internal_build_skyline (list<Building>*,
45                                list<Building> *const result);
46   bool is_legal_skyline () const;
47
48 public:
49   Skyline ();
50   Skyline (Direction sky);
51   Skyline (vector<Box> const &bldgs, Axis a, Direction sky);
52
53   void merge (Skyline const &);
54   void insert (Box const &, Axis);
55   void raise (Real);
56   Real distance (Skyline const &) const;
57   Real height (Real airplane) const;
58   Real max_height () const;
59   void set_minimum_height (Real height);
60   Stencil stencil ();
61 };
62
63 #endif /* SKYLINE_HH */
64