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