xref: /haiku/headers/libs/agg/agg_arc.h (revision bc3955fea5b07e2e94a27fc05e4bb58fe6f0319b)
1 //----------------------------------------------------------------------------
2 // Anti-Grain Geometry - Version 2.4
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 //----------------------------------------------------------------------------
15 //
16 // Arc vertex generator
17 //
18 //----------------------------------------------------------------------------
19 
20 #ifndef AGG_ARC_INCLUDED
21 #define AGG_ARC_INCLUDED
22 
23 #include <math.h>
24 #include "agg_basics.h"
25 
26 namespace agg
27 {
28 
29     //=====================================================================arc
30     //
31     // See Implementation agg_arc.cpp
32     //
33     class arc
34     {
35     public:
36         arc() : m_scale(1.0), m_initialized(false) {}
37         arc(double x,  double y,
38             double rx, double ry,
39             double a1, double a2,
40             bool ccw=true);
41 
42         void init(double x,  double y,
43                   double rx, double ry,
44                   double a1, double a2,
45                   bool ccw=true);
46 
47         void approximation_scale(double s);
48         double approximation_scale() const { return m_scale;  }
49 
50         void rewind(unsigned);
51         unsigned vertex(double* x, double* y);
52 
53     private:
54         void normalize(double a1, double a2, bool ccw);
55 
56         double   m_x;
57         double   m_y;
58         double   m_rx;
59         double   m_ry;
60         double   m_angle;
61         double   m_start;
62         double   m_end;
63         double   m_scale;
64         double   m_da;
65         bool     m_ccw;
66         bool     m_initialized;
67         unsigned m_path_cmd;
68     };
69 
70 
71 }
72 
73 
74 #endif
75