]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/bezier.hh
patch::: 1.1.60.jcn2
[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 #include "drul-array.hh"
17 #include "interval.hh"
18
19 /**
20   Simple bezier curve
21  */
22 class Bezier
23 {
24 public:
25   Bezier ();
26
27   /**
28   Calculate bezier curve into Offset (x,y) array.
29   */
30   void calc (int steps);
31   void print () const;
32
33   void set (Array<Offset> points);
34
35   /**
36   Return y that goes with x by interpolation.
37   */
38   Real y (Real x);
39
40   Curve curve_;
41   Curve control_;
42 };
43
44 /**
45   Implement bow specific bezier curve
46  */
47 class Bezier_bow : public Bezier
48 {
49 public:
50   Bezier_bow (Paper_def* paper_l);
51
52   /**
53    Calculate bezier curve for bow from bow paratime_signatures.
54    */
55   void blow_fit ();
56   void calc ();
57   Real calc_f (Real height);
58   void calc_bezier ();
59   bool calc_clipping ();
60   void calc_controls ();
61   void calc_default (Real h);
62   void calc_return (Real begin_alpha, Real end_alpha);
63   void calc_tangent_controls ();
64   bool check_fit_bo ();
65   Real check_fit_f ();
66   void print () const;
67   void set (Array<Offset> points, int dir);
68   void transform ();
69   void transform_back ();
70
71   Paper_def* paper_l_;
72   Curve encompass_;
73   int dir_;
74   Real alpha_;
75   Offset origin_;
76   Curve return_;
77   Drul_array<Interval> curve_extent_drul_;
78 };
79
80
81 #endif // BEZIER_HH
82