MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / DoRound

Method DoRound

TheForceEngine/TFE_Polygon/clipper.cpp:4196–4215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4194//------------------------------------------------------------------------------
4195
4196void ClipperOffset::DoRound(int j, int k)
4197{
4198 double a = std::atan2(m_sinA,
4199 m_normals[k].X * m_normals[j].X + m_normals[k].Y * m_normals[j].Y);
4200 int steps = std::max((int)Round(m_StepsPerRad * std::fabs(a)), 1);
4201
4202 double X = m_normals[k].X, Y = m_normals[k].Y, X2;
4203 for (int i = 0; i < steps; ++i)
4204 {
4205 m_destPoly.push_back(IntPoint(
4206 Round(m_srcPoly[j].X + X * m_delta),
4207 Round(m_srcPoly[j].Y + Y * m_delta)));
4208 X2 = X;
4209 X = X * m_cos - m_sin * Y;
4210 Y = X2 * m_sin + Y * m_cos;
4211 }
4212 m_destPoly.push_back(IntPoint(
4213 Round(m_srcPoly[j].X + m_normals[j].X * m_delta),
4214 Round(m_srcPoly[j].Y + m_normals[j].Y * m_delta)));
4215}
4216
4217//------------------------------------------------------------------------------
4218// Miscellaneous public functions

Callers

nothing calls this directly

Calls 4

maxFunction · 0.85
RoundFunction · 0.85
IntPointClass · 0.85
push_backMethod · 0.80

Tested by

no test coverage detected