| 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)); |
nothing calls this directly
no test coverage detected