]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/bezier.hh
* lily/include/bezier-bow.hh: remove.
[lilypond.git] / lily / include / bezier.hh
1 /*
2   bezier.hh -- declare Bezier and Bezier_bow
3
4   (c) 1998--2004 Jan Nieuwenhuizen <janneke@gnu.org>
5 */
6
7 #ifndef BEZIER_HH
8 #define BEZIER_HH
9
10
11 #include "real.hh"
12 #include "drul-array.hh"
13 #include "interval.hh"
14 #include "offset.hh"
15 #include "array.hh"
16 #include "polynomial.hh"
17
18 /**
19   Simple bezier curve
20  */
21 class Bezier
22 {
23 public:
24   void assert_sanity () const;
25   void scale (Real x,Real y);
26   void reverse ();
27   void rotate (Real);
28   void translate (Offset);
29
30   Real get_other_coordinate (Axis a, Real x) const;
31   Array<Real> solve_point (Axis, Real coordinate) const;
32   Array<Real> solve_derivative (Offset) const;
33   Interval extent (Axis)const;
34   Polynomial polynomial (Axis)const;
35   Offset curve_point (Real t) const;
36
37   static const int CONTROL_COUNT = 4;
38
39   /*
40     Bezier curves always have 4 control points. Making this into an
41     Array<> gives unnecessary overhead, and makes debugging a royal
42     pain.  */
43
44   
45   Offset control_[4];
46 };
47
48 void scale (Array<Offset>* array, Real xscale, Real yscale);
49 void rotate (Array<Offset>* array, Real phi);
50 void translate (Array<Offset>* array, Offset o);
51
52
53
54 Bezier slur_shape (Real width, Real height_limit,
55                    Real height_proportion);
56 Real slur_height (Real width, Real height_limit, Real height_proportion); 
57 void get_slur_indent_height (Real * indent, Real *height, Real width, Real h_inf, Real r_0);
58
59 #endif // BEZIER_HH
60