27 : x_(vector(0)), y_(vector(1)) {}
30 constexpr int x()
const {
return x_; }
33 constexpr void set_x(
int val) { x_ = val; }
36 constexpr int y()
const {
return y_; }
39 constexpr void set_y(
int val) { y_ = val; }
42 constexpr Eigen::Vector2i
as_vector()
const {
return Eigen::Vector2i(x_, y_); }
50 constexpr Eigen::Vector2d
as_vector(Eigen::Vector2d X, Eigen::Vector2d Y)
const {
51 return Eigen::Vector2d(
52 x_ * X(0) + y_ * Y(0),
59 return cevalm::abs(x_ - other.x_) + cevalm::abs(y_ - other.y_);
63 constexpr int manhattan_norm()
const {
return cevalm::abs(x_) + cevalm::abs(y_); }
66 constexpr double distance(
Point2d other)
const {
return cevalm::hypot(x_ - other.x_, y_ - other.y_); }
69 constexpr double norm()
const {
return cevalm::hypot(x_, y_); }
89 constexpr int dot(
Point2d other)
const {
return (x_ * other.x_) + (y_ * other.y_); }
constexpr void set_x(int val)
Sets the x coordinate.
Definition point2d.h:33
constexpr int manhattan_norm() const
Calculates the manhattan distance away from the origin.
Definition point2d.h:63
constexpr Point2d operator-(Point2d other) const
Definition point2d.h:114
constexpr bool operator==(Point2d other) const
Definition point2d.h:161
constexpr Point2d operator*(int scalar) const
Definition point2d.h:138
constexpr Eigen::Vector2i as_vector() const
Gets the point as an Eigen::Vector2i.
Definition point2d.h:42
constexpr Point2d inverse() const
Definition point2d.h:79
constexpr Point2d & operator+=(Point2d other)
Adds another point to this point.
Definition point2d.h:103
constexpr void set_y(int val)
Sets the y coordinate.
Definition point2d.h:39
constexpr Eigen::Vector2d as_vector(Eigen::Vector2d X, Eigen::Vector2d Y) const
Definition point2d.h:50
constexpr Point2d operator-() const
Definition point2d.h:127
constexpr double norm() const
Calculates the distance (as a continuous number) away from the origin.
Definition point2d.h:69
constexpr int operator*(Point2d other) const
Definition point2d.h:151
constexpr Point2d(Eigen::Vector2i vector)
Definition point2d.h:26
constexpr Point2d operator+(Point2d other) const
Definition point2d.h:100
constexpr int x() const
Gets the X coordinate of the point.
Definition point2d.h:30
constexpr Point2d(int x, int y)
Definition point2d.h:20
constexpr int y() const
Gets the Y coordinate of the point.
Definition point2d.h:36
constexpr Point2d()
Default constructor for Point2d creating a lattice point at the origin.
Definition point2d.h:13
constexpr Point2d & operator-=(Point2d other)
Subtracts another point from this point.
Definition point2d.h:117
constexpr Point2d & operator*=(int scalar)
Multiplies this point by a scalar.
Definition point2d.h:154
constexpr int manhattan_distance(Point2d other) const
Calculates the manhattan distance between two points.
Definition point2d.h:58
constexpr int dot(Point2d other) const
Definition point2d.h:89
friend constexpr Point2d operator*(int scalar, Point2d point)
Scales the point.
Definition point2d.h:141
constexpr double distance(Point2d other) const
Calculates the distance (as a continuous number) between two points.
Definition point2d.h:66