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