23 #ifndef COM_DAFER45_TBTK_VECTOR_2D 24 #define COM_DAFER45_TBTK_VECTOR_2D 27 #include <initializer_list> 45 Vector2d(std::initializer_list<double> components);
48 Vector2d(
const std::vector<double> &components);
105 result.
x =
x - rhs.
x;
106 result.
y =
y - rhs.
y;
132 result.
x = lhs*rhs.
x;
133 result.
y = lhs*rhs.
y;
148 return (*
this)/
norm();
160 return sqrt(
x*
x +
y*
y);
164 return lhs.
x*rhs.
x + lhs.
y*rhs.
y;
168 std::vector<double> result;
177 stream <<
"(" << v.
x <<
", " << v.
y <<
")";
const Vector2d operator/(double rhs) const
Definition: Vector2d.h:138
double y
Definition: Vector2d.h:39
const Vector2d unit() const
Definition: Vector2d.h:147
Definition: Vector2d.h:33
const Vector2d perpendicular(const Vector2d &v) const
Definition: Vector2d.h:151
const Vector2d operator-() const
Definition: Vector2d.h:111
double x
Definition: Vector2d.h:36
double norm() const
Definition: Vector2d.h:159
const Vector2d operator+(const Vector2d &rhs) const
Definition: Vector2d.h:93
const Vector2d parallel(const Vector2d &v) const
Definition: Vector2d.h:155
const std::vector< double > getStdVector() const
Definition: Vector2d.h:167
static double dotProduct(const Vector2d &lhs, const Vector2d &rhs)
Definition: Vector2d.h:163
friend std::ostream & operator<<(std::ostream &stream, const Vector2d &v)
Definition: Vector2d.h:176
const Vector2d operator*(double rhs) const
Definition: Vector2d.h:120