]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/skyline.hh
fix tuplet example
[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--2007 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   Building (Box const &b, Real horizon_padding, Axis a, Direction d);
32   void print () const;
33
34   Real height (Real x) const;
35   Real intersection_x (Building const &other) const;
36   void leading_part (Real chop);
37   bool conceals_beginning (Building const &other) const;
38   bool conceals (Building const &other) const;
39   bool sane () const;
40   Building sloped_neighbour (Real horizon_padding, Direction d) const;
41
42   bool operator< (Building const &other)
43   {
44     return iv_[LEFT] < other.iv_[LEFT];
45   }
46 };
47
48 class Skyline
49 {
50 private:
51   list<Building> buildings_;
52   Direction sky_;
53   
54   void internal_merge_skyline (list<Building>*, list<Building>*,
55                                list<Building> *const result);
56   list<Building> internal_build_skyline (list<Building>*);
57
58   DECLARE_SIMPLE_SMOBS(Skyline);
59 public:
60   Skyline ();
61   Skyline (Skyline const &src);
62   Skyline (Direction sky);
63   Skyline (vector<Box> const &bldgs, Real horizon_padding, Axis a, Direction sky);
64   Skyline (Box const &b, Real horizon_padding, Axis a, Direction sky);
65   vector<Offset> to_points () const;
66   void merge (Skyline const &);
67   void insert (Box const &, Real horizon_padding, Axis);
68   void print () const;
69   void raise (Real);
70   void shift (Real);
71   Real distance (Skyline const &) const;
72   Real height (Real airplane) const;
73   Real max_height () const;
74   void set_minimum_height (Real height);
75 };
76
77 class Skyline_pair
78 {
79 private:
80   Drul_array<Skyline> skylines_;
81
82   DECLARE_SIMPLE_SMOBS(Skyline_pair);
83 public:
84   Skyline_pair ();
85   Skyline_pair (vector<Box> const &boxes, Real horizon_padding, Axis a);
86   Skyline_pair (Box const &, Real horizon_padding, Axis a);
87   void raise (Real);
88   void shift (Real);
89   void insert (Box const &, Real horizon_padding, Axis);
90   void merge (Skyline_pair const &other);
91   Skyline &operator [] (Direction d);
92   Skyline const &operator [] (Direction d) const;
93 };
94
95 #endif /* SKYLINE_HH */
96