10 #ifndef INCLUDE_SVECTOR_VECTOR2D_HPP_
11 #define INCLUDE_SVECTOR_VECTOR2D_HPP_
93 double angle()
const {
return std::atan2(this->
y(), this->
x()); }
114 const double xPrime = this->
x() * std::cos(ang) - this->
y() * std::sin(ang);
115 const double yPrime = this->
x() * std::sin(ang) + this->
y() * std::cos(ang);
133 return T{this->
x(), this->
y()};
Contains a base vector representation.
A base vector representation.
Definition: vector.hpp:34
Vector()
No-argument constructor.
Definition: vector.hpp:67
std::array< T, D > m_components
An array of components for the vector.
Definition: vector.hpp:630
A simple 2D vector representation.
Definition: vector2d.hpp:25
double angle() const
Angle of vector.
Definition: vector2d.hpp:93
T componentsAs() const
Converts vector to another object.
Definition: vector2d.hpp:132
double x() const
Gets x-component.
Definition: vector2d.hpp:55
Vector2D rotate(const double ang) const
Rotates vector by a certain angle.
Definition: vector2d.hpp:106
Vector2D(const Vec2_ &other)
Copy constructor for base class.
Definition: vector2d.hpp:43
void y(const double &newY)
Sets y-component.
Definition: vector2d.hpp:82
Vector2D(const double x, const double y)
Initializes a vector given xy components.
Definition: vector2d.hpp:35
void x(const double &newX)
Sets x-component.
Definition: vector2d.hpp:64
double y() const
Gets y-component.
Definition: vector2d.hpp:73