OLD | NEW |
1 | 1 |
2 //---------------------------------------------------------------------------- | 2 //---------------------------------------------------------------------------- |
3 // Anti-Grain Geometry - Version 2.3 | 3 // Anti-Grain Geometry - Version 2.3 |
4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) | 4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) |
5 // | 5 // |
6 // Permission to copy, use, modify, sell and distribute this software | 6 // Permission to copy, use, modify, sell and distribute this software |
7 // is granted provided this copyright notice appears in all copies. | 7 // is granted provided this copyright notice appears in all copies. |
8 // This software is provided "as is" without express or implied | 8 // This software is provided "as is" without express or implied |
9 // warranty, and with no claim as to its suitability for any purpose. | 9 // warranty, and with no claim as to its suitability for any purpose. |
10 // | 10 // |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 if(closed) { | 63 if(closed) { |
64 while(base_type::size() > 1) { | 64 while(base_type::size() > 1) { |
65 if((*this)[base_type::size() - 1]((*this)[0])) { | 65 if((*this)[base_type::size() - 1]((*this)[0])) { |
66 break; | 66 break; |
67 } | 67 } |
68 base_type::remove_last(); | 68 base_type::remove_last(); |
69 } | 69 } |
70 } | 70 } |
71 } | 71 } |
72 const FX_FLOAT vertex_dist_epsilon = 1e-14f; | 72 const FX_FLOAT vertex_dist_epsilon = 1e-14f; |
73 struct vertex_dist : public CFX_Object { | 73 struct vertex_dist { |
74 FX_FLOAT x; | 74 FX_FLOAT x; |
75 FX_FLOAT y; | 75 FX_FLOAT y; |
76 FX_FLOAT dist; | 76 FX_FLOAT dist; |
77 vertex_dist() {} | 77 vertex_dist() {} |
78 vertex_dist(FX_FLOAT x_, FX_FLOAT y_) : | 78 vertex_dist(FX_FLOAT x_, FX_FLOAT y_) : |
79 x(x_), | 79 x(x_), |
80 y(y_), | 80 y(y_), |
81 dist(0) | 81 dist(0) |
82 { | 82 { |
83 } | 83 } |
84 bool operator () (const vertex_dist& val) | 84 bool operator () (const vertex_dist& val) |
85 { | 85 { |
86 bool ret = (dist = calc_distance(x, y, val.x, val.y)) > vertex_dist_epsi
lon; | 86 bool ret = (dist = calc_distance(x, y, val.x, val.y)) > vertex_dist_epsi
lon; |
87 return ret; | 87 return ret; |
88 } | 88 } |
89 }; | 89 }; |
90 struct vertex_dist_cmd : public vertex_dist { | 90 struct vertex_dist_cmd : public vertex_dist { |
91 unsigned cmd; | 91 unsigned cmd; |
92 vertex_dist_cmd() {} | 92 vertex_dist_cmd() {} |
93 vertex_dist_cmd(FX_FLOAT x_, FX_FLOAT y_, unsigned cmd_) : | 93 vertex_dist_cmd(FX_FLOAT x_, FX_FLOAT y_, unsigned cmd_) : |
94 vertex_dist(x_, y_), | 94 vertex_dist(x_, y_), |
95 cmd(cmd_) | 95 cmd(cmd_) |
96 { | 96 { |
97 } | 97 } |
98 }; | 98 }; |
99 } | 99 } |
100 #endif | 100 #endif |
OLD | NEW |