45 constexpr
Vec2d(
const double x,
const double y) noexcept :
x_(
x),
y_(
y) {}
54 double x()
const {
return x_; }
57 double y()
const {
return y_; }
double x() const
Getter for x component.
Definition: vec2d.h:54
Vec2d & operator/=(const double ratio)
Divides this Vec2d by a scalar.
Vec2d operator/(const double ratio) const
Divides Vec2d by a scalar.
double y() const
Getter for y component.
Definition: vec2d.h:57
bool operator==(const Vec2d &other) const
Compares two Vec2d.
double DistanceSquareTo(const Vec2d &other) const
Returns the squared distance to the given vector.
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
constexpr Vec2d() noexcept
Constructor returning the zero vector.
Definition: vec2d.h:48
double y_
Definition: vec2d.h:127
constexpr Vec2d(const double x, const double y) noexcept
Constructor which takes x- and y-coordinates.
Definition: vec2d.h:45
Vec2d operator+(const Vec2d &other) const
Sums two Vec2d.
Vec2d & operator+=(const Vec2d &other)
Sums another Vec2d to the current one.
double InnerProd(const Vec2d &other) const
Returns the inner product between these two Vec2d.
double LengthSquare() const
Gets the squared length of the vector.
double CrossProd(const Vec2d &other) const
Returns the "cross" product between these two Vec2d (non-standard).
Implements a class of 2-dimensional vectors.
Definition: vec2d.h:42
double DistanceTo(const Vec2d &other) const
Returns the distance to the given vector.
double x_
Definition: vec2d.h:126
void SelfRotate(const double angle)
rotate the vector itself by angle.
Vec2d operator-(const Vec2d &other) const
Subtracts two Vec2d.
std::string DebugString() const
Returns a human-readable string representing this object.
static Vec2d CreateUnitVec2d(const double angle)
Creates a unit-vector with a given angle to the positive x semi-axis.
void set_x(const double x)
Setter for x component.
Definition: vec2d.h:60
double Angle() const
Gets the angle between the vector and the positive x semi-axis.
Vec2d & operator*=(const double ratio)
Multiplies this Vec2d by a scalar.
Vec2d operator*(const double ratio) const
Multiplies Vec2d by a scalar.
void Normalize()
Returns the unit vector that is co-linear with this vector.
Vec2d & operator-=(const Vec2d &other)
Subtracts another Vec2d to the current one.
double Length() const
Gets the length of the vector.
void set_y(const double y)
Setter for y component.
Definition: vec2d.h:63
Vec2d rotate(const double angle) const
rotate the vector by angle.
constexpr double kMathEpsilon
Definition: vec2d.h:35