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

Function GetUnitNormal

renderers/agg/src/clipper.cpp:2309–2319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2307//------------------------------------------------------------------------------
2308
2309DoublePoint GetUnitNormal( const IntPoint &pt1, const IntPoint &pt2)
2310{
2311 double dx = static_cast<double>(pt2.X - pt1.X);
2312 double dy = static_cast<double>(pt2.Y - pt1.Y);
2313 if( ( dx == 0 ) && ( dy == 0 ) ) return DoublePoint( 0, 0 );
2314
2315 double f = 1 *1.0/ std::sqrt( dx*dx + dy*dy );
2316 dx *= f;
2317 dy *= f;
2318 return DoublePoint(dy, -dx);
2319}
2320//------------------------------------------------------------------------------
2321
2322Polygons OffsetPolygons(const Polygons &pts, const float &delta)

Callers 1

OffsetPolygonsFunction · 0.85

Calls 1

DoublePointClass · 0.85

Tested by

no test coverage detected