![]() |
levelz-cpp 0.2.0
|
#include <coordinate.hpp>
Public Member Functions | |
| Coordinate2D () | |
| Coordinate2D (int x, int y) | |
| Coordinate2D (double x, double y) | |
| Coordinate2D (std::vector< int > xy) | |
| Coordinate2D (std::array< int, 2 > xy) | |
| Coordinate2D (std::vector< double > xy) | |
| Coordinate2D (std::array< double, 2 > xy) | |
| double | getMagnitude () const |
| bool | operator== (const Coordinate2D &other) const |
| bool | operator!= (const Coordinate2D &other) const |
| Coordinate2D | operator+ (const Coordinate2D &other) const |
| Coordinate2D | operator- (const Coordinate2D &other) const |
| Coordinate2D | operator* (int scalar) const |
| Coordinate2D | operator/ (int scalar) const |
| std::string | to_string () const |
| std::ostream & | operator<< (std::ostream &strm) |
Static Public Member Functions | |
| static Coordinate2D | from_string (const std::string &str) |
Public Attributes | |
| double | x |
| double | y |
Represents a 2D coordinate.
|
inline |
Initializes a new instance of the Coordinate2D class at [0, 0].
|
inline |
Initializes a new instance of the Coordinate2D class at the specified coordinates.
| x | The X coordinate. |
| y | The Y coordinate. |
|
inline |
Initializes a new instance of the Coordinate2D class at the specified coordinates.
| x | The X coordinate. |
| y | The Y coordinate. |
|
inline |
Initializes a new instance of the Coordinate2D class at the specified coordinates.
| xy | The X and Y coordinates in a vector. |
|
inline |
Initializes a new instance of the Coordinate2D class at the specified coordinates.
| xy | The X and Y coordinates in an array. |
|
inline |
Initializes a new instance of the Coordinate2D class at the specified coordinates.
| xy | The X and Y coordinates in a vector. |
|
inline |
Initializes a new instance of the Coordinate2D class at the specified coordinates.
| xy | The X and Y coordinates in an array. |
|
inlinestatic |
Converts a string to a 2D coordinate.
| str | The string to convert. |
|
inlinevirtual |
Gets the magnitude of the coordinate.
Implements LevelZ::Coordinate.
|
inline |
Compares two coordinates for inequality.
| other | The other coordinate to compare to. |
|
inline |
Multiplies the coordinate by a scalar.
| scalar | The scalar to multiply by. |
|
inline |
Adds two coordinates together.
| other | The other coordinate to add. |
|
inline |
Subtracts one coordinate from another.
| other | The other coordinate to subtract. |
|
inline |
Divides the coordinate by a scalar.
| scalar | The scalar to divide by. |
|
inline |
Overloads the << operator to allow for easy printing of a Coordinate2D.
| strm | The output stream to write to. |
|
inline |
Compares two coordinates for equality.
| other | The other coordinate to compare to. |
|
inlinevirtual |
Converts this 2D coordinate to a string.
Implements LevelZ::Coordinate.
| double LevelZ::Coordinate2D::x |
The X coordinate.
| double LevelZ::Coordinate2D::y |
The Y coordinate.