]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/skyline.hh
skyline cleanup, and from_points, to_points functionality
[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
14 #include "axis.hh"
15 #include "box.hh"
16 #include "interval.hh"
17 #include "direction.hh"
18 #include "std-vector.hh"
19 #include "stencil.hh"
20
21 struct Building
22 {
23   Interval iv_;
24   Real start_height_;
25   Real end_height_;
26
27   Real zero_height_;
28   Real slope_;
29
30   void precompute (Real max_slope);
31   Building (Real start, Real start_height, Real end_height, Real end, Real max_slope);
32
33   Real height (Real x) const;
34   Real intersection (Building const &other) const;
35   void leading_part (Real chop, Real h);
36   bool obstructs (Building const &other) const;
37 };
38
39 class Skyline
40 {
41 private:
42   list<Building> buildings_;
43   Direction sky_;
44   Real max_slope_;              // fixme: not part of skyline per se?
45   
46   void internal_merge_skyline (list<Building>*, list<Building>*,
47                                list<Building> *const result);
48   void internal_build_skyline (list<Building>*,
49                                list<Building> *const result);
50   bool is_legal_skyline () const;
51
52 public:
53   Skyline ();
54   Skyline (Direction sky);
55   Skyline (vector<Box> const &bldgs, Axis a, Direction sky);
56   Skyline (vector<Offset> const &points, Real max_slope, Direction sky);
57   vector<Offset> to_points () const;
58   void merge (Skyline const &);
59   void insert (Box const &, Axis);
60   void raise (Real);
61   Real distance (Skyline const &) const;
62   Real height (Real airplane) const;
63   Real max_height () const;
64   void set_minimum_height (Real height);
65 };
66
67 Stencil to_stencil (Skyline const &line);
68
69 #endif /* SKYLINE_HH */
70