]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/skyline.hh
add horizon_padding to skylines (although it is currently always 0)
[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 "smobs.hh"
20
21 struct Building
22 {
23   Interval iv_;
24   Drul_array<Real> height_;
25
26   Real y_intercept_;
27   Real slope_;
28
29   void precompute ();
30   Building (Real start, Real start_height, Real end_height, Real end);
31   void print () const;
32
33   Real height (Real x) const;
34   Real intersection (Building const &other) const;
35   void leading_part (Real chop);
36   bool conceals_beginning (Building const &other) const;
37   bool conceals (Building const &other) const;
38   Building sloped_neighbour (Real horizon_padding, Direction d) const;
39 };
40
41 class Skyline
42 {
43 private:
44   list<Building> buildings_;
45   Direction sky_;
46   
47   void internal_merge_skyline (list<Building>*, list<Building>*,
48                                list<Building> *const result);
49   void internal_build_skyline (list<Building>*, list<Building> *const result);
50   bool is_legal_skyline () const;
51
52   DECLARE_SIMPLE_SMOBS(Skyline);
53 public:
54   Skyline ();
55   Skyline (Skyline const &src);
56   Skyline (Direction sky);
57   Skyline (vector<Box> const &bldgs, Real horizon_padding, Axis a, Direction sky);
58   vector<Offset> to_points () const;
59   void merge (Skyline const &);
60   void insert (Box const &, Real horizon_padding, Axis);
61   void print () const;
62   void raise (Real);
63   Real distance (Skyline const &) const;
64   Real height (Real airplane) const;
65   Real max_height () const;
66   void set_minimum_height (Real height);
67 };
68
69 #endif /* SKYLINE_HH */
70