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_vpgen_segmentator.h"
22 void vpgen_segmentator::move_to(double x
, double y
)
30 m_cmd
= path_cmd_move_to
;
33 void vpgen_segmentator::line_to(double x
, double y
)
39 double len
= sqrt(m_dx
* m_dx
+ m_dy
* m_dy
) * m_approximation_scale
;
40 if(len
< 1e-30) len
= 1e-30;
42 m_dl
= (m_cmd
== path_cmd_move_to
) ? 0.0 : m_ddl
;
43 if(m_cmd
== path_cmd_stop
) m_cmd
= path_cmd_line_to
;
46 unsigned vpgen_segmentator::vertex(double* x
, double* y
)
48 if(m_cmd
== path_cmd_stop
) return path_cmd_stop
;
51 m_cmd
= path_cmd_line_to
;
52 if(m_dl
>= 1.0 - m_ddl
)
55 m_cmd
= path_cmd_stop
;
60 *x
= m_x1
+ m_dx
* m_dl
;
61 *y
= m_y1
+ m_dy
* m_dl
;