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

Function BuildArc

renderers/agg/src/clipper.cpp:2291–2306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2289};
2290
2291Polygon BuildArc(const IntPoint &pt,
2292 const double a1, const double a2, const double r)
2293{
2294 int steps = std::max(6, int(std::sqrt(std::abs(r)) * std::abs(a2 - a1)));
2295 Polygon result(steps);
2296 int n = steps - 1;
2297 double da = (a2 - a1) / n;
2298 double a = a1;
2299 for (int i = 0; i <= n; ++i)
2300 {
2301 result[i].X = pt.X + Round(std::cos(a)*r);
2302 result[i].Y = pt.Y + Round(std::sin(a)*r);
2303 a += da;
2304 }
2305 return result;
2306}
2307//------------------------------------------------------------------------------
2308
2309DoublePoint GetUnitNormal( const IntPoint &pt1, const IntPoint &pt2)

Callers 1

OffsetPolygonsFunction · 0.85

Calls 1

RoundFunction · 0.85

Tested by

no test coverage detected