ASGE
3.2.0
Simple Game Framework in GL
|
#include <Point2D.hpp>
Public Member Functions | |
Point2D (float x=0, float y=0) | |
Point2D & | operator= (const Point2D &) |
Point2D | midpoint (const Point2D &rhs) const |
float | distance (const Point2D &rhs) const |
Point2D & | operator+= (const Point2D &rhs) |
Point2D & | operator*= (float scalar) |
Point2D | operator* (float scalar) const |
Point2D (const Point2D &)=default | |
Point2D (Point2D &&) noexcept | |
Point2D & | operator= (Point2D &&) noexcept |
bool | operator== (const Point2D &rhs) const |
bool | operator!= (const Point2D &rhs) const |
std::string | toString () const |
Public Attributes | |
float | x = 0 |
float | y = 0 |
A point in 2D space.
Used to represent a position in 2D space. Includes some basic helper functionality for distance and mid-point calculations.
Definition at line 30 of file Point2D.hpp.
ASGE::Point2D::Point2D | ( | float | x = 0 , |
float | y = 0 |
||
) |
Default constructor. The constructor takes will default the position to 0,0 unless the x or x and y parameters are provided. These are then mapped on the x,y values inside the struct.
x | The x coordinate. |
y | The y coordinate. |
float ASGE::Point2D::distance | ( | const Point2D & | rhs | ) | const |
Distance. Given two points, calculate the distance between them.
The | second point to use. |
Midpoint. Calculates the midpoint between two different points.
rhs | The second point to use. |
Assigns the value of another point2D to this one. Assignment constructor, that copies each field from rhs in to the lhs.
Point2D. |
std::string ASGE::Point2D::toString | ( | ) | const |
float ASGE::Point2D::x = 0 |
the x position.
Definition at line 32 of file Point2D.hpp.
float ASGE::Point2D::y = 0 |
the y position.
Definition at line 33 of file Point2D.hpp.