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

Function rotatePointAroundCenter

src/Core/Transform/Rect.cpp:11–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9namespace obe::Transform
10{
11 UnitVector rotatePointAroundCenter(
12 const UnitVector& center, const UnitVector& Around, double angle)
13 {
14 const double cY = std::cos(angle);
15 const double sY = std::sin(angle);
16
17 UnitVector moved;
18 const UnitVector delta = Around - center;
19 moved.x = (delta.x * cY - delta.y * sY) + center.x;
20 moved.y = (delta.x * sY + delta.y * cY) + center.y;
21
22 return moved;
23 };
24
25 double Rect::getRotation() const
26 {

Callers 2

rotateMethod · 0.85
setPointPositionMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected