]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/bezier.hh
* Another grand 2003 update.
[lilypond.git] / lily / include / bezier.hh
1 /*
2   bezier.hh -- declare Bezier and Bezier_bow
3
4   (c)  1998--2003 Jan Nieuwenhuizen <janneke@gnu.org>
5 */
6
7 #ifndef BEZIER_HH
8 #define BEZIER_HH
9
10
11 #include "real.hh"
12 #include "drul-array.hh"
13 #include "interval.hh"
14 #include "axes.hh"
15 #include "offset.hh"
16 #include "array.hh"
17 #include "polynomial.hh"
18
19 /**
20   Simple bezier curve
21  */
22 class Bezier
23 {
24 public:
25   void assert_sanity () const;
26   void scale (Real x,Real y);
27   void reverse ();
28   void rotate (Real);
29   void translate (Offset);
30
31   Real get_other_coordinate (Axis a, Real x) const;
32   Array<Real> solve_point (Axis, Real coordinate) const;
33   Array<Real> solve_derivative (Offset) const;
34   Interval extent (Axis)const;
35   Polynomial polynomial (Axis)const;
36   Offset curve_point (Real t) const;
37
38   static const int CONTROL_COUNT = 4;
39
40   /*
41     Bezier curves always have 4 control points. Making this into an
42     Array<> gives unnecessary overhead, and makes debugging a royal
43     pain.  */
44
45   
46   Offset control_[4];
47 };
48
49 void scale (Array<Offset>* array, Real xscale, Real yscale);
50 void rotate (Array<Offset>* array, Real phi);
51 void translate (Array<Offset>* array, Offset o);
52
53 #endif // BEZIER_HH
54