1 //----------------------------------------------------------------------------
2 // Anti-Grain Geometry - Version 2.3
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 //----------------------------------------------------------------------------
17 #include "agg_trans_warp_magnifier.h"
22 //------------------------------------------------------------------------
23 void trans_warp_magnifier::transform(double* x
, double* y
) const
25 double dx
= *x
- m_xc
;
26 double dy
= *y
- m_yc
;
27 double r
= sqrt(dx
* dx
+ dy
* dy
);
30 *x
= m_xc
+ dx
* m_magn
;
31 *y
= m_yc
+ dy
* m_magn
;
35 double m
= (r
+ m_radius
* (m_magn
- 1.0)) / r
;
40 //------------------------------------------------------------------------
41 void trans_warp_magnifier::inverse_transform(double* x
, double* y
) const
43 trans_warp_magnifier
t(*this);
44 t
.magnification(1.0 / m_magn
);
45 t
.radius(m_radius
* m_magn
);