diff --git a/include/units/Vector2D.hpp b/include/units/Vector2D.hpp index dec54c4..ccbb610 100644 --- a/include/units/Vector2D.hpp +++ b/include/units/Vector2D.hpp @@ -199,13 +199,6 @@ template class Vector2D { return (*this); } - /** - * @brief angle of the vector from the origin - * - * @return Angle - */ - constexpr Angle theta() const { return atan2(this->y, this->x); } - /** * @brief magnitude of the vector * @@ -240,46 +233,19 @@ template class Vector2D { */ constexpr Vector2D normalize() const { return (*this) / magnitude(); } - /** - * @brief rotate the vector by an angle - * - * @param angle - */ - constexpr void rotateBy(Angle angle) { - const T m = magnitude(); - const Angle t = theta() + angle; - this->x = m * cos(t); - this->y = m * sin(t); - } - - /** - * @brief rotate the vector to an angle - * - * @param angle - */ - constexpr void rotateTo(Angle angle) { - const T m = magnitude(); - this->x = m * cos(angle); - this->y = m * sin(angle); - } - /** * @brief get a copy of this vector rotated by an angle * * @param angle * @return Vector2D */ - constexpr Vector2D rotatedBy(Angle angle) const { return fromPolar(theta() + angle, magnitude()); } - - /** - * @brief get a copy of this vector rotated to an angle - * - * @param angle - * @return Vector2D - */ - constexpr Vector2D rotatedTo(Angle angle) const { return fromPolar(angle, magnitude()); } + constexpr Vector2D rotatedBy(Angle angle) const { + return fromPolar(Vector2D({T(0.0), T(0.0)}).angleTo(*this) + angle, magnitude()); + } }; +template inline constexpr Vector2D origin({T(0.0), T(0.0)}); + /** * @brief * operator overload. Multiplies a quantity and a vector * diff --git a/src/main.cpp b/src/main.cpp index 600c123..a1ae2f4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -16,7 +16,6 @@ void initialize() { units::AccelerationPose a(1_mps2, 2_mps2); Number num = Number(1.0); num = Number(0.0); - a.theta().convert(deg); a.orientation = Quantity, std::ratio<0>, std::ratio<-2>, std::ratio<0>, std::ratio<1>, std::ratio<0>, std::ratio<0>, std::ratio<0>>(1.0); a.orientation += 2_rpm2;