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

Function calc_polygon_area

renderers/agg/include/agg_math.h:230–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228
229 //-------------------------------------------------------calc_polygon_area
230 template<class Storage> double calc_polygon_area(const Storage& st)
231 {
232 unsigned i;
233 double sum = 0.0;
234 double x = st[0].x;
235 double y = st[0].y;
236 double xs = x;
237 double ys = y;
238
239 for(i = 1; i < st.size(); i++)
240 {
241 const typename Storage::value_type& v = st[i];
242 sum += x * v.y - y * v.x;
243 x = v.x;
244 y = v.y;
245 }
246 return (sum + x * ys - y * xs) * 0.5;
247 }
248
249 //------------------------------------------------------------------------
250 // Tables for fast sqrt

Callers 1

rewindMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected