RIT VEXU Core API
Loading...
Searching...
No Matches
Point2d Class Reference

#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)

Detailed Description

Class representing a lattice point

Constructor & Destructor Documentation

◆ Point2d() [1/3]

Point2d::Point2d ( )
inlineconstexpr

Default constructor for Point2d creating a lattice point at the origin

◆ Point2d() [2/3]

Point2d::Point2d ( const int & x,
const int & y )

Creates a lattice point at the coordinate (x,y)

Parameters
xThe x-coordinate of the point
yThe y-coordinate of the point

◆ Point2d() [3/3]

Point2d::Point2d ( const Eigen::Vector2i & vector)

Creates a lattice point with the values from the given vector

Parameters
vectorThe vector whose values will be used

Member Function Documentation

◆ as_vector() [1/2]

Eigen::Vector2i Point2d::as_vector ( ) const

Returns the point as an Eigen::Vector2i

Returns
Eigen::Vector2i with the same values as the point

Returns the vector as an Eigen::Vector2i

Returns
Eigen::Vector2i with the same values as the point

◆ as_vector() [2/2]

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

Parameters
XThe vector corresponding to <1, 0> in the basis of X and Y
YThe 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

◆ distance()

double Point2d::distance ( const Point2d & other) const

Returns the distance (as a continuous number) between two points

Returns
The distance (as a continuous number) between two points

◆ manhattan_distance()

int Point2d::manhattan_distance ( const Point2d & other) const

Returns the manhattan distance between two points

Returns
The manhattan distance between two points

◆ manhattan_norm()

int Point2d::manhattan_norm ( ) const

Returns the manhattan distance away from the origin

Returns
The manhattan norm of the point

◆ norm()

double Point2d::norm ( ) const

Returns the distance (as a continuous number) away from the origin

Returns
The norm (as a continuous number) of the point

◆ operator*() [1/2]

Point2d Point2d::operator* ( const int & scalar) const

Returns this point multiplied by a scalar

[x] = [x] * [scalar] [y] = [y] * [scalar]

Parameters
scalarThe scalar to multiply by
Returns
This point multiplied by a scalar

◆ operator*() [2/2]

int Point2d::operator* ( const Point2d & other) const

Returns the dot product of two points

[scalar] = [x][otherx] + [y][othery]

Parameters
otherThe other point to find the dot product with
Returns
The scalar-valued dot product

◆ operator+()

Point2d Point2d::operator+ ( const Point2d & other) const

Returns the sum of two points

[x] = [x] + [otherx] [y] = [y] + [otherx]

Parameters
otherThe other point to be added
Returns
The sum of the two points

◆ operator-() [1/2]

Point2d Point2d::operator- ( ) const

Returns the inverse of the point

[x] = -[x] [y] = -[y]

Returns
The inverse of the point

◆ operator-() [2/2]

Point2d Point2d::operator- ( const Point2d & other) const

Returns the difference of two points

[x] = [x] - [otherx] [y] = [y] - [otherx]

Parameters
otherThe point being subtracted from this one
Returns
The difference of the two points

◆ operator==()

bool Point2d::operator== ( const Point2d & other) const

Compares two points

Parameters
otherThe other Point2d to compare to
Returns
TRUE if the components of both points are equal, and FALSE if otherwise

◆ setX()

void Point2d::setX ( const int & x)

Sets the X coordinate of the point

◆ setY()

void Point2d::setY ( const int & y)

Sets the Y coordinate of the point

◆ x()

int Point2d::x ( ) const

Returns the X coordinate of the point

Returns
The X coordinate of the point

◆ y()

int Point2d::y ( ) const

Returns the Y coordinate of the point

Returns
The Y coordinate of the point

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const Point2d & point )
friend

Sends a point to an output stream. Ex: The code std::cout << point; prints "Point2d[x: (value), y: (value)]"


The documentation for this class was generated from the following files: