MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / rotate

Method rotate

src/Core/Transform/Polygon.cpp:320–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

318 }
319
320 void Polygon::rotate(float angle, Transform::UnitVector origin)
321 {
322 m_angle += angle;
323
324 const double radAngle = (Utils::Math::pi / 180.0) * -angle;
325 for (auto& point : m_points)
326 {
327 point->set(std::cos(radAngle) * (point->x - origin.x)
328 - std::sin(radAngle) * (point->y - origin.y) + origin.x,
329 std::sin(radAngle) * (point->x - origin.x)
330 + std::cos(radAngle) * (point->y - origin.y) + origin.y);
331 }
332 }
333
334 void Polygon::move(const Transform::UnitVector& position)
335 {

Callers 1

setRotationMethod · 0.95

Calls 1

setMethod · 0.45

Tested by

no test coverage detected