]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/bezier.hh
release: 1.1.29
[lilypond.git] / lily / include / bezier.hh
1 /*
2   bezier.hh -- declare Bezier and Bezier_bow
3
4   (c) 1998--1999 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   void print () const;
30
31   void set (Array<Offset> points);
32
33   /**
34   Return y that goes with x by interpolation.
35   */
36   Real y (Real x);
37
38   Curve curve_;
39   Curve control_;
40 };
41
42 /**
43   Implement bow specific bezier curve
44  */
45 class Bezier_bow : public Bezier
46 {
47 public:
48   Bezier_bow (Paper_def* paper_l);
49
50   /**
51    Calculate bezier curve for bow from bow paratime_signatures.
52    */
53   void blow_fit ();
54   void calc ();
55   Real calc_f (Real height);
56   void calc_bezier ();
57   bool calc_clipping ();
58   void calc_controls ();
59   void calc_default (Real h);
60   void calc_return (Real begin_alpha, Real end_alpha);
61   void calc_tangent_controls ();
62   bool check_fit_bo ();
63   Real check_fit_f ();
64   void print () const;
65   void set (Array<Offset> points, int dir);
66   void transform ();
67   void transform_back ();
68
69   Paper_def* paper_l_;
70   Curve encompass_;
71   int dir_;
72   Real alpha_;
73   Offset origin_;
74   Curve return_;
75 };
76
77
78 #endif // BEZIER_HH
79