1 //----------------------------------------------------------------------------
2 // Anti-Grain Geometry - Version 2.4
3 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
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.
10 //----------------------------------------------------------------------------
11 // Contact: mcseem@antigrain.com
12 // mcseemagg@yahoo.com
13 // http://www.antigrain.com
14 //----------------------------------------------------------------------------
16 // Simple Bresenham interpolator for ellipsees
18 //----------------------------------------------------------------------------
20 #ifndef AGG_ELLIPSE_BRESENHAM_INCLUDED
21 #define AGG_ELLIPSE_BRESENHAM_INCLUDED
24 #include "agg_basics.h"
30 //------------------------------------------ellipse_bresenham_interpolator
31 class ellipse_bresenham_interpolator
34 ellipse_bresenham_interpolator(int rx
, int ry
) :
37 m_two_rx2(m_rx2
<< 1),
38 m_two_ry2(m_ry2
<< 1),
42 m_inc_y(-ry
* m_two_rx2
),
46 int dx() const { return m_dx
; }
47 int dy() const { return m_dy
; }
51 int mx
, my
, mxy
, min_m
;
54 mx
= fx
= m_cur_f
+ m_inc_x
+ m_ry2
;
57 my
= fy
= m_cur_f
+ m_inc_y
+ m_rx2
;
60 mxy
= fxy
= m_cur_f
+ m_inc_x
+ m_ry2
+ m_inc_y
+ m_rx2
;
61 if(mxy
< 0) mxy
= -mxy
;