xref: /haiku/headers/libs/agg/agg_vcgen_bspline.h (revision 4f00613311d0bd6b70fa82ce19931c41f071ea4e)
1 //----------------------------------------------------------------------------
2 // Anti-Grain Geometry - Version 2.2
3 // Copyright (C) 2002-2004 Maxim Shemanarev (http://www.antigrain.com)
4 //
5 // Permission to copy, use, modify, sell and distribute this software
6 // is granted provided this copyright notice appears in all copies.
7 // This software is provided "as is" without express or implied
8 // warranty, and with no claim as to its suitability for any purpose.
9 //
10 //----------------------------------------------------------------------------
11 // Contact: mcseem@antigrain.com
12 //          mcseemagg@yahoo.com
13 //          http://www.antigrain.com
14 //----------------------------------------------------------------------------
15 
16 #ifndef AGG_VCGEN_BSPLINE_INCLUDED
17 #define AGG_VCGEN_BSPLINE_INCLUDED
18 
19 #include "agg_basics.h"
20 #include "agg_array.h"
21 #include "agg_bspline.h"
22 
23 
24 namespace agg
25 {
26 
27     //==========================================================vcgen_bspline
28     class vcgen_bspline
29     {
30         enum status_e
31         {
32             initial,
33             ready,
34             polygon,
35             end_poly,
36             stop
37         };
38 
39     public:
40         typedef pod_deque<point_type, 6> vertex_storage;
41 
42         vcgen_bspline();
43 
44         void interpolation_step(double v) { m_interpolation_step = v; }
45         double interpolation_step() const { return m_interpolation_step; }
46 
47         // Vertex Generator Interface
48         void remove_all();
49         void add_vertex(double x, double y, unsigned cmd);
50 
51         // Vertex Source Interface
52         void     rewind(unsigned id);
53         unsigned vertex(double* x, double* y);
54 
55     private:
56         vcgen_bspline(const vcgen_bspline&);
57         const vcgen_bspline& operator = (const vcgen_bspline&);
58 
59         vertex_storage m_src_vertices;
60         bspline        m_spline_x;
61         bspline        m_spline_y;
62         double         m_interpolation_step;
63         unsigned       m_closed;
64         status_e       m_status;
65         unsigned       m_src_vertex;
66         double         m_cur_abscissa;
67         double         m_max_abscissa;
68     };
69 
70 }
71 
72 
73 #endif
74 
75