|
RIT VEXU Core API
|
#include <point2d.h>
Public Member Functions | |
| constexpr | Point2d () |
| Point2d (const int &x, const int &y) | |
| Point2d (const Eigen::Vector2i &vector) | |
| int | x () const |
| void | setX (const int &x) |
| int | y () const |
| void | setY (const int &y) |
| Eigen::Vector2i | as_vector () const |
| Eigen::Vector2d | as_vector (Eigen::Vector2d X, Eigen::Vector2d Y) const |
| int | manhattan_distance (const Point2d &other) const |
| int | manhattan_norm () const |
| double | distance (const Point2d &other) const |
| double | norm () const |
| bool | operator== (const Point2d &other) const |
| Point2d | operator+ (const Point2d &other) const |
| Point2d | operator- (const Point2d &other) const |
| Point2d | operator- () const |
| Point2d | operator* (const int &scalar) const |
| int | operator* (const Point2d &other) const |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Point2d &point) |
Class representing a lattice point
|
inlineconstexpr |
Default constructor for Point2d creating a lattice point at the origin
| Point2d::Point2d | ( | const int & | x, |
| const int & | y ) |
Creates a lattice point at the coordinate (x,y)
| x | The x-coordinate of the point |
| y | The y-coordinate of the point |
| Point2d::Point2d | ( | const Eigen::Vector2i & | vector | ) |
Creates a lattice point with the values from the given vector
| vector | The vector whose values will be used |
| Eigen::Vector2i Point2d::as_vector | ( | ) | const |
Returns the point as an Eigen::Vector2i
Returns the vector as an Eigen::Vector2i
| Eigen::Vector2d Point2d::as_vector | ( | Eigen::Vector2d | X, |
| Eigen::Vector2d | Y ) const |
Returns a vector in the canonical basis corresponding to the point in the basis of X and Y
| 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 |
| double Point2d::distance | ( | const Point2d & | other | ) | const |
Returns the distance (as a continuous number) between two points
| int Point2d::manhattan_distance | ( | const Point2d & | other | ) | const |
Returns the manhattan distance between two points
| int Point2d::manhattan_norm | ( | ) | const |
Returns the manhattan distance away from the origin
| double Point2d::norm | ( | ) | const |
Returns the distance (as a continuous number) away from the origin
| Point2d Point2d::operator* | ( | const int & | scalar | ) | const |
Returns this point multiplied by a scalar
[x] = [x] * [scalar] [y] = [y] * [scalar]
| scalar | The scalar to multiply by |
| int Point2d::operator* | ( | const Point2d & | other | ) | const |
Returns the dot product of two points
[scalar] = [x][otherx] + [y][othery]
| other | The other point to find the dot product with |
Returns the sum of two points
[x] = [x] + [otherx] [y] = [y] + [otherx]
| other | The other point to be added |
| Point2d Point2d::operator- | ( | ) | const |
Returns the inverse of the point
[x] = -[x] [y] = -[y]
Returns the difference of two points
[x] = [x] - [otherx] [y] = [y] - [otherx]
| other | The point being subtracted from this one |
| bool Point2d::operator== | ( | const Point2d & | other | ) | const |
Compares two points
| other | The other Point2d to compare to |
| void Point2d::setX | ( | const int & | x | ) |
Sets the X coordinate of the point
| void Point2d::setY | ( | const int & | y | ) |
Sets the Y coordinate of the point
| int Point2d::x | ( | ) | const |
Returns the X coordinate of the point
| int Point2d::y | ( | ) | const |
Returns the Y coordinate of the point
|
friend |
Sends a point to an output stream. Ex: The code std::cout << point; prints "Point2d[x: (value), y: (value)]"