]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/bezier.hh
release: 1.0.1
[lilypond.git] / lily / include / bezier.hh
1 /*
2   bezier.hh -- declare Bezier and Bezier_bow
3
4   (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
5 */
6
7 #ifndef BEZIER_HH
8 #define BEZIER_HH
9
10 #ifndef STANDALONE
11 #include "lily-proto.hh"
12 #endif
13
14 #include "real.hh"
15 #include "curve.hh"
16
17 /**
18   Simple bezier curve
19  */
20 class Bezier
21 {
22 public:
23   Bezier ();
24
25   /**
26   Calculate bezier curve into Offset (x,y) array.
27   */
28   void calc (int steps);
29
30   void set (Array<Offset> points);
31
32   /**
33   Return y that goes with x by interpolation.
34   */
35   Real y (Real x);
36
37   Curve curve_;
38   Curve control_;
39 };
40
41 /**
42   Implement bow specific bezier curve
43  */
44 class Bezier_bow : public Bezier
45 {
46 public:
47   Bezier_bow (Paper_def* paper_l);
48
49   /**
50    Calculate bezier curve for bow from bow paratime_signatures.
51    */
52   void blow_fit ();
53   void calc ();
54   Real calc_f (Real height);
55   void calc_bezier ();
56   bool calc_clipping ();
57   void calc_controls ();
58   void calc_default (Real h);
59   void calc_return (Real begin_alpha, Real end_alpha);
60   void calc_tangent_controls ();
61   bool check_fit_bo ();
62   Real check_fit_f ();
63   void set (Array<Offset> points, int dir);
64   void transform ();
65   void transform_back ();
66
67   Paper_def* paper_l_;
68   Curve encompass_;
69   int dir_;
70   Real alpha_;
71   Offset origin_;
72   Curve return_;
73 };
74
75
76 #endif // BEZIER_HH
77