138 return std::sqrt(
x *
x +
y *
y);
152 return (*
this - other).getNorm();
164 return x * other.
y -
y * other.
x;
243 std::ostream& operator<<(std::ostream& os, const Vector2<T>& vec)
245 os <<
"(" << vec.
x <<
", " << vec.y <<
")";
T getNorm() const
Compute the euclidean norm of the vector.
Vector2< T > operator*(T t, Vector2< T > vec)
Compute the product of a scalar by a vector.
Vector2< T > getOrthogonal() const
Get the orthogonal vector.
Class representing a 2D vector.
Vector2< T > operator*(Vector2< T > vec, T t)
Compute the product of a vector by a scalar.
Vector2< T > operator+(Vector2< T > lhs, const Vector2< T > &rhs)
Compute the sum of two vectors.
Vector2< T > operator-(Vector2< T > lhs, const Vector2< T > &rhs)
Compute the difference of two vectors.
Vector2< T > & operator-=(const Vector2< T > &other)
Substract a vector.
Vector2< T > & operator*=(T t)
Multiply by a scalar.
T getDistance(const Vector2< T > &other) const
Compute the euclidean distance of this point to another point.
Vector2< T > operator-() const
Compute the opposite vector.
T getDet(const Vector2< T > &other) const
Compute the determinant with another vector.
Vector2< T > & operator+=(const Vector2< T > &other)
Add a vector.