| 1213 | //------------------------------------------------------------------------ |
| 1214 | template<class VC> |
| 1215 | unsigned path_base<VC>::perceive_polygon_orientation(unsigned start, |
| 1216 | unsigned end) |
| 1217 | { |
| 1218 | // Calculate signed area (double area to be exact) |
| 1219 | //--------------------- |
| 1220 | unsigned np = end - start; |
| 1221 | double area = 0.0; |
| 1222 | unsigned i; |
| 1223 | for(i = 0; i < np; i++) |
| 1224 | { |
| 1225 | double x1, y1, x2, y2; |
| 1226 | m_vertices.vertex(start + i, &x1, &y1); |
| 1227 | m_vertices.vertex(start + (i + 1) % np, &x2, &y2); |
| 1228 | area += x1 * y2 - y1 * x2; |
| 1229 | } |
| 1230 | return (area < 0.0) ? path_flags_cw : path_flags_ccw; |
| 1231 | } |
| 1232 | |
| 1233 | //------------------------------------------------------------------------ |
| 1234 | template<class VC> |