]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/bezier.hh
* lily/context.cc (where_defined): also assign value in
[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 #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
26   Real get_other_coordinate (Axis a, Real x) const;
27   Array<Real> solve_point (Axis, Real coordinate) const;
28   Array<Real> solve_derivative (Offset) const;
29   Interval extent (Axis)const;
30   Polynomial polynomial (Axis)const;
31   Offset curve_point (Real t) const;
32   Real curve_coordinate (Real t, Axis) 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   Offset control_[4];
42 };
43
44 void scale (Array<Offset> *array, Real xscale, Real yscale);
45 void rotate (Array<Offset> *array, Real phi);
46 void translate (Array<Offset> *array, Offset o);
47
48 Bezier slur_shape (Real width, Real height_limit,
49                    Real height_proportion);
50 Real slur_height (Real width, Real height_limit, Real height_proportion);
51 void get_slur_indent_height (Real *indent, Real *height, Real width, Real h_inf, Real r_0);
52
53 #endif // BEZIER_HH
54