]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/bezier.hh
release: 0.1.57
[lilypond.git] / lily / include / bezier.hh
1 /*
2   bezier.hh -- declare Bezier and Bezier_bow
3
4   (c) 1998 Jan Nieuwenhuizen <jan@digicash.com>
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 (int steps_i);
24
25   /**
26   Calculate bezier curve into Offset (x,y) array.
27   */
28   void calc ();
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 parameters.
51    */
52   void blow_fit ();
53   Real calc_f (Real height);
54   void calc ();
55   void calc_controls ();
56   void calc_default (Real h);
57   void calc_return (Real begin_alpha, Real end_alpha);
58   bool check_fit_bo ();
59   Real check_fit_f ();
60   void set (Array<Offset> points, int dir);
61   void transform ();
62   void transform_controls_back ();
63
64   Paper_def* paper_l_;
65   Curve encompass_;
66   int dir_;
67   Real alpha_;
68   Offset origin_;
69   Curve return_;
70 };
71
72
73 #endif // BEZIER_HH
74