]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/bezier.hh
partial: 0.1.55.jcn
[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 #include "lily-proto.hh"
11 #include "real.hh"
12
13 /**
14  Handy (x,y) of reals for Bezier  
15  */
16 struct Point
17 {
18   Real x;
19   Real y;
20 };
21
22 /**
23   Simple bezier curve
24  */
25 class Bezier
26 {
27 public:
28   Bezier (int steps_i);
29   virtual ~Bezier ();
30
31   /**
32   Calculate bezier curve into Point (x,y) array.
33   */
34   void calc (Point control[4]);
35
36   /**
37   Return y that goes with x by interpolation.
38   */
39   Real y (Real x);
40
41   int steps_i_;
42   Point* curve_;
43 };
44
45 /**
46   Implement bow specific bezier curve
47  */
48 class Bezier_bow : public Bezier
49 {
50 public:
51   Bezier_bow (Paper_def* paper_l);
52
53   /**
54    Calculate bezier curve for bow from bow parameters.
55    */
56   void calc (Real dx, Real dy, Real h, Real d);
57   Paper_def* paper_l_;
58 };
59
60
61 #endif // BEZIER_HH