update dev300-m58
[ooovba.git] / agg / inc / agg_curves.h
blobb69e218a0e07b6452aa2add60c0f8ca4d0d7b863
1 //----------------------------------------------------------------------------
2 // Anti-Grain Geometry - Version 2.3
3 // Copyright (C) 2002-2005 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 //----------------------------------------------------------------------------
16 // classes curve3 and curve4
18 //----------------------------------------------------------------------------
20 #ifndef AGG_CURVES_INCLUDED
21 #define AGG_CURVES_INCLUDED
23 #include "agg_basics.h"
24 #include "agg_vertex_iterator.h"
26 namespace agg
29 // See Implemantation agg_curves.cpp
32 //------------------------------------------------------------------curve3
33 class curve3
35 public:
36 curve3() :
37 m_num_steps(0), m_step(0), m_scale(1.0) { }
39 curve3(double x1, double y1,
40 double x2, double y2,
41 double x3, double y3) :
42 m_num_steps(0), m_step(0), m_scale(1.0)
44 init(x1, y1, x2, y2, x3, y3);
47 void reset() { m_num_steps = 0; m_step = -1; }
48 void init(double x1, double y1,
49 double x2, double y2,
50 double x3, double y3);
51 void approximation_scale(double s) { m_scale = s; }
52 double approximation_scale() const { return m_scale; }
54 void rewind(unsigned id);
55 unsigned vertex(double* x, double* y);
57 typedef curve3 source_type;
58 typedef vertex_iterator<source_type> iterator;
59 iterator begin(unsigned id) { return iterator(*this, id); }
60 iterator end() { return iterator(path_cmd_stop); }
62 private:
63 int m_num_steps;
64 int m_step;
65 double m_scale;
66 double m_start_x;
67 double m_start_y;
68 double m_end_x;
69 double m_end_y;
70 double m_fx;
71 double m_fy;
72 double m_dfx;
73 double m_dfy;
74 double m_ddfx;
75 double m_ddfy;
76 double m_saved_fx;
77 double m_saved_fy;
78 double m_saved_dfx;
79 double m_saved_dfy;
88 //-----------------------------------------------------------------curve4
89 class curve4
91 public:
92 curve4() :
93 m_num_steps(0), m_step(0), m_scale(1.0) { }
95 curve4(double x1, double y1,
96 double x2, double y2,
97 double x3, double y3,
98 double x4, double y4) :
99 m_num_steps(0), m_step(0), m_scale(1.0)
101 init(x1, y1, x2, y2, x3, y3, x4, y4);
104 void reset() { m_num_steps = 0; m_step = -1; }
105 void init(double x1, double y1,
106 double x2, double y2,
107 double x3, double y3,
108 double x4, double y4);
110 void approximation_scale(double s) { m_scale = s; }
111 double approximation_scale() const { return m_scale; }
113 void rewind(unsigned id);
114 unsigned vertex(double* x, double* y);
116 typedef curve4 source_type;
117 typedef vertex_iterator<source_type> iterator;
118 iterator begin(unsigned id) { return iterator(*this, id); }
119 iterator end() { return iterator(path_cmd_stop); }
121 private:
122 int m_num_steps;
123 int m_step;
124 double m_scale;
125 double m_start_x;
126 double m_start_y;
127 double m_end_x;
128 double m_end_y;
129 double m_fx;
130 double m_fy;
131 double m_dfx;
132 double m_dfy;
133 double m_ddfx;
134 double m_ddfy;
135 double m_dddfx;
136 double m_dddfy;
137 double m_saved_fx;
138 double m_saved_fy;
139 double m_saved_dfx;
140 double m_saved_dfy;
141 double m_saved_ddfx;
142 double m_saved_ddfy;
150 #endif