MCPcopy Create free account
hub / github.com/MapServer/MapServer / IsClockwise

Function IsClockwise

renderers/agg/src/clipper.cpp:52–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50//------------------------------------------------------------------------------
51
52bool IsClockwise(const Polygon &poly)
53{
54 int highI = poly.size() -1;
55 if (highI < 2) return false;
56 double a;
57 a = static_cast<double>(poly[highI].X) * static_cast<double>(poly[0].Y) -
58 static_cast<double>(poly[0].X) * static_cast<double>(poly[highI].Y);
59 for (int i = 0; i < highI; ++i)
60 a += static_cast<double>(poly[i].X) * static_cast<double>(poly[i+1].Y) -
61 static_cast<double>(poly[i+1].X) * static_cast<double>(poly[i].Y);
62 //area := area/2;
63 return a > 0; //ie reverse of normal formula because assume Y axis inverted
64}
65//------------------------------------------------------------------------------
66
67bool IsClockwise(PolyPt *pt)

Callers 1

BuildResultMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected