Defines a point in 2D space.
More...
#include <Point.h>
|
| | Point (const int x=0, const int y=0) |
| | Instantiates a new point object.
|
| |
| | ~Point () |
| |
| void | Set (const int x, const int y) |
| | Sets the components of the point.
|
| |
| void | Set (const Point point) |
| | Sets the components of the vecpointtor.
|
| |
| bool | IsOrigin () const |
| | Determines if the point is located at the origin.
|
| |
| const Vector2 | ToVector2 () const |
| | Converts the point into a vector.
|
| |
| std::string | ToString () const |
| | Gets a string representation of the point.
|
| |
| void | Display () const |
| | Prints the point to the console.
|
| |
| Point & | operator= (const Point &point) |
| | Assigns the reference of a point.
|
| |
| Point & | operator+= (const Point &point) |
| | Adds a point.
|
| |
| Point & | operator-= (const Point &point) |
| | Subtracts a point.
|
| |
| const Point | operator+ (const Point &point) const |
| | Adds two points.
|
| |
| const Point | operator- (const Point &point) const |
| | Subtracts a point from another.
|
| |
| bool | operator== (const Point &point) const |
| | Determines if two points are equal.
|
| |
| bool | operator!= (const Point &point) const |
| | Determines if two points are not equal.
|
| |
|
| int | X = 0 |
| | The x-coordinate of the point.
|
| |
| int | Y = 0 |
| | The y-coordinate of the point.
|
| |
Defines a point in 2D space.
Definition at line 22 of file Point.h.
◆ Point()
| KatanaEngine::Point::Point |
( |
const int | x = 0, |
|
|
const int | y = 0 ) |
Instantiates a new point object.
- Parameters
-
| x | The X component |
| y | The Y component |
Definition at line 22 of file Point.cpp.
◆ ~Point()
| KatanaEngine::Point::~Point |
( |
| ) |
|
|
inline |
◆ Display()
| void KatanaEngine::Point::Display |
( |
| ) |
const |
|
inline |
Prints the point to the console.
Definition at line 61 of file Point.h.
◆ IsOrigin()
| bool KatanaEngine::Point::IsOrigin |
( |
| ) |
const |
|
inline |
Determines if the point is located at the origin.
- Returns
- Returns true if both components are zero, false otherwise.
Definition at line 50 of file Point.h.
◆ operator!=()
| bool KatanaEngine::Point::operator!= |
( |
const Point & | point | ) |
const |
Determines if two points are not equal.
- Parameters
-
| point | The point to compare. |
- Returns
- Returns true if the points are not equal, false otherwise.
Definition at line 89 of file Point.cpp.
◆ operator+()
| const Point KatanaEngine::Point::operator+ |
( |
const Point & | point | ) |
const |
Adds two points.
- Parameters
-
- Returns
- Returns the resulting point.
Definition at line 74 of file Point.cpp.
◆ operator+=()
| Point & KatanaEngine::Point::operator+= |
( |
const Point & | point | ) |
|
Adds a point.
- Parameters
-
- Returns
- Returns the resulting point.
Definition at line 58 of file Point.cpp.
◆ operator-()
| const Point KatanaEngine::Point::operator- |
( |
const Point & | point | ) |
const |
Subtracts a point from another.
- Parameters
-
| point | The point to subtract. |
- Returns
- Returns the resulting point.
Definition at line 79 of file Point.cpp.
◆ operator-=()
| Point & KatanaEngine::Point::operator-= |
( |
const Point & | point | ) |
|
Subtracts a point.
- Parameters
-
| point | The point to subtract. |
- Returns
- Returns the resulting point.
Definition at line 66 of file Point.cpp.
◆ operator=()
| Point & KatanaEngine::Point::operator= |
( |
const Point & | point | ) |
|
Assigns the reference of a point.
- Parameters
-
| point | The reference point. |
- Returns
- Returns the resulting point.
Definition at line 47 of file Point.cpp.
◆ operator==()
| bool KatanaEngine::Point::operator== |
( |
const Point & | point | ) |
const |
Determines if two points are equal.
- Parameters
-
| point | The point to compare. |
- Returns
- Returns true if the points are equal, false otherwise.
Definition at line 84 of file Point.cpp.
◆ Set() [1/2]
| void KatanaEngine::Point::Set |
( |
const int | x, |
|
|
const int | y ) |
Sets the components of the point.
- Parameters
-
| x | The X component. |
| y | The Y component. |
Definition at line 28 of file Point.cpp.
◆ Set() [2/2]
| void KatanaEngine::Point::Set |
( |
const Point | point | ) |
|
Sets the components of the vecpointtor.
- Parameters
-
| point | The point whose components to copy. |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 34 of file Point.cpp.
◆ ToString()
| std::string KatanaEngine::Point::ToString |
( |
| ) |
const |
Gets a string representation of the point.
- Returns
- Returns a string displaying the components of the point.
Definition at line 40 of file Point.cpp.
◆ ToVector2()
| const Vector2 KatanaEngine::Point::ToVector2 |
( |
| ) |
const |
Converts the point into a vector.
- Returns
- Returns a displacement vector to the point.
Definition at line 94 of file Point.cpp.
◆ Origin
| const Point KatanaEngine::Point::Origin = Point(0, 0) |
|
static |
A point located at the origin.
Definition at line 34 of file Point.h.
| int KatanaEngine::Point::X = 0 |
The x-coordinate of the point.
Definition at line 100 of file Point.h.
| int KatanaEngine::Point::Y = 0 |
The y-coordinate of the point.
Definition at line 101 of file Point.h.
The documentation for this class was generated from the following files: