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 //----------------------------------------------------------------------------
15 #ifndef AGG_PATH_LENGTH_INCLUDED
16 #define AGG_PATH_LENGTH_INCLUDED
22 template<class VertexSource
>
23 double path_length(VertexSource
& vs
, unsigned path_id
= 0)
36 while(!is_stop(cmd
= vs
.vertex(&x2
, &y2
)))
40 if(first
|| is_move_to(cmd
))
47 len
+= calc_distance(x1
, y1
, x2
, y2
);
55 if(is_close(cmd
) && !first
)
57 len
+= calc_distance(x1
, y1
, start_x
, start_y
);