Class representing a lattice point.
More...
#include <point2d.h>
|
|
constexpr | Point2d () |
| | Default constructor for Point2d creating a lattice point at the origin.
|
| constexpr | Point2d (int x, int y) |
| constexpr | Point2d (Eigen::Vector2i vector) |
|
constexpr int | x () const |
| | Gets the X coordinate of the point.
|
|
constexpr void | set_x (int val) |
| | Sets the x coordinate.
|
|
constexpr int | y () const |
| | Gets the Y coordinate of the point.
|
|
constexpr void | set_y (int val) |
| | Sets the y coordinate.
|
|
constexpr Eigen::Vector2i | as_vector () const |
| | Gets the point as an Eigen::Vector2i.
|
| constexpr Eigen::Vector2d | as_vector (Eigen::Vector2d X, Eigen::Vector2d Y) const |
|
constexpr int | manhattan_distance (Point2d other) const |
| | Calculates the manhattan distance between two points.
|
|
constexpr int | manhattan_norm () const |
| | Calculates the manhattan distance away from the origin.
|
|
constexpr double | distance (Point2d other) const |
| | Calculates the distance (as a continuous number) between two points.
|
|
constexpr double | norm () const |
| | Calculates the distance (as a continuous number) away from the origin.
|
| constexpr Point2d | inverse () const |
| constexpr int | dot (Point2d other) const |
| constexpr Point2d | operator+ (Point2d other) const |
|
constexpr Point2d & | operator+= (Point2d other) |
| | Adds another point to this point.
|
| constexpr Point2d | operator- (Point2d other) const |
|
constexpr Point2d & | operator-= (Point2d other) |
| | Subtracts another point from this point.
|
| constexpr Point2d | operator- () const |
| constexpr Point2d | operator* (int scalar) const |
| constexpr int | operator* (Point2d other) const |
|
constexpr Point2d & | operator*= (int scalar) |
| | Multiplies this point by a scalar.
|
| constexpr bool | operator== (Point2d other) const |
|
|
constexpr Point2d | operator* (int scalar, Point2d point) |
| | Scales the point.
|
Class representing a lattice point.
◆ Point2d() [1/2]
| Point2d::Point2d |
( |
int | x, |
|
|
int | y ) |
|
inlineconstexpr |
Creates a lattice point at the coordinate (x,y)
- Parameters
-
| x | The x-coordinate of the point |
| y | The y-coordinate of the point |
◆ Point2d() [2/2]
| Point2d::Point2d |
( |
Eigen::Vector2i | vector | ) |
|
|
inlineconstexpr |
Creates a lattice point with the values from the given vector
- Parameters
-
| vector | The vector whose values will be used |
◆ as_vector()
| Eigen::Vector2d Point2d::as_vector |
( |
Eigen::Vector2d | X, |
|
|
Eigen::Vector2d | Y ) const |
|
inlineconstexpr |
Gets a vector in the canonical basis corresponding to the point in the basis of X and Y
- Parameters
-
| X | The vector corresponding to <1, 0> in the basis of X and Y |
| Y | The vector corresponding to <0, 1> in the basis of X and Y |
- Returns
- The point as a linear combination of the X and Y vectors
◆ dot()
| int Point2d::dot |
( |
Point2d | other | ) |
const |
|
inlineconstexpr |
Returns the dot product of two points
[scalar] = [x][otherx] + [y][othery]
- Parameters
-
| other | The other point to find the dot product with |
- Returns
- The scalar-valued dot product
◆ inverse()
Returns the inverse of the point
[x] = -[x] [y] = -[y]
- Returns
- The inverse of the point
◆ operator*() [1/2]
| Point2d Point2d::operator* |
( |
int | scalar | ) |
const |
|
inlineconstexpr |
Returns this point multiplied by a scalar
[x] = [x] * [scalar] [y] = [y] * [scalar]
- Parameters
-
| scalar | The scalar to multiply by |
- Returns
- This point multiplied by a scalar
◆ operator*() [2/2]
| int Point2d::operator* |
( |
Point2d | other | ) |
const |
|
inlineconstexpr |
Computes the dot product of two points
[scalar] = [x][otherx] + [y][othery]
- Parameters
-
| other | The other point to find the dot product with |
- Returns
- The scalar-valued dot product
◆ operator+()
Returns the sum of two points
[x] = [x] + [otherx] [y] = [y] + [otherx]
- Parameters
-
| other | The other point to be added |
- Returns
- The sum of the two points
◆ operator-() [1/2]
| Point2d Point2d::operator- |
( |
| ) |
const |
|
inlineconstexpr |
Computes the inverse of the point
[x] = -[x] [y] = -[y]
- Returns
- The inverse of the point
◆ operator-() [2/2]
Returns the difference of two points
[x] = [x] - [otherx] [y] = [y] - [otherx]
- Parameters
-
| other | The point being subtracted from this one |
- Returns
- The difference of the two points
◆ operator==()
| bool Point2d::operator== |
( |
Point2d | other | ) |
const |
|
inlineconstexpr |
Compares two points
- Parameters
-
| other | The other Point2d to compare to |
- Returns
- TRUE if the components of both points are equal, and FALSE if otherwise
The documentation for this class was generated from the following file: