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

Method rotate

src/Core/Transform/UnitVector.cpp:294–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292 }
293
294 UnitVector UnitVector::rotate(double angle, UnitVector zero) const
295 {
296 const double radAngle = Utils::Math::convertToRadian(angle);
297 Matrix2D rot({ std::cos(radAngle), -std::sin(radAngle), std::sin(radAngle),
298 std::cos(radAngle) });
299 const UnitVector result = rot.product(*this - zero) + zero;
300 return result;
301 }
302 double UnitVector::distance(const UnitVector& vec) const
303 {
304 return std::sqrt(std::pow(x - vec.x, 2) + std::pow(y - vec.y, 2));

Callers

nothing calls this directly

Calls 2

convertToRadianFunction · 0.85
productMethod · 0.80

Tested by

no test coverage detected