MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
|
#include <Point.h>
Public Member Functions | |
Point () | |
Point (T x, T y) | |
Point (const Point< T > &p) | |
Point (Random &random, T maxX, T maxY) | |
~Point () | |
T | GetX () const |
T | GetY () const |
u32 | GetManhattanLength () const |
u32 | GetMaximumLength () const |
double | GetEuclideanLength () const |
void | Clear () |
void | Add (const Point< T > &offset) |
void | Add (T x, T y) |
void | Subtract (const Point< T > &offset) |
void | Subtract (T x, T y) |
void | Multiply (T scalar) |
void | Divide (T scalar) |
void | Mod (T scalar) |
void | SetX (T x) |
void | SetY (T y) |
void | Set (T x, T y) |
void | Set (const Point< T > ©From) |
bool | Equals (const Point< T > &rhs) const |
bool | BoundedBelow (const Point< T > &bound) const |
bool | BoundedAbove (const Point< T > &bound) const |
bool | BoundedBy (const Point< T > &lowerBound, const Point< T > &upperBound) const |
bool | IsZero () const |
void | Parse (char *buffer) |
Point< T > & | operator= (const Point< T > &rhs) |
Point< T > & | operator+= (const Point< T > &rhs) |
Point< T > & | operator-= (const Point< T > &rhs) |
Point< T > & | operator*= (const s32 rhs) |
Point< T > & | operator/= (const s32 rhs) |
Friends | |
Point< T > | max (const Point< T > &lhs, const Point< T > &rhs) |
Point< T > | min (const Point< T > &lhs, const Point< T > &rhs) |
Point< T > | operator+ (const Point< T > &lhs, const Point< T > &rhs) |
Point< T > | operator- (const Point< T > &lhs, const Point< T > &rhs) |
bool | operator== (const Point< T > &lhs, const Point< T > &rhs) |
bool | operator!= (const Point< T > &lhs, const Point< T > &rhs) |
Point< T > | operator* (const Point< T > &lhs, const s32 rhs) |
Point< T > | operator/ (const Point< T > &lhs, const s32 rhs) |
Point< T > | operator% (const Point< T > &lhs, const s32 rhs) |
Two-dimension integral coordinates template class. Primary uses are UPoint – two unsigned 32 bit numbers – and SPoint – two signed 32 bit numbers.
MFM::Point< T >::Point | ( | ) |
Constructs a new Point whose coordinates are initially set to 0
.
MFM::Point< T >::Point | ( | T | x, |
T | y | ||
) |
MFM::Point< T >::Point | ( | const Point< T > & | p | ) |
MFM::Point< T >::Point | ( | Random & | random, |
T | maxX, | ||
T | maxY | ||
) |
Constructs a new Point with randomly chosen coordinates, between 0
and a specified maximum value .
random | The PRNG used to choose the random numbers for the coordinates of the new Point . |
maxX | The maximum X value that can be chosen by random . |
maxY | The maximum Y value that can be chosen by random . |
|
inline |
Deconstructs this Point .
void MFM::Point< T >::Add | ( | const Point< T > & | offset | ) |
void MFM::Point< T >::Add | ( | T | x, |
T | y | ||
) |
bool MFM::Point< T >::BoundedAbove | ( | const Point< T > & | bound | ) | const |
bool MFM::Point< T >::BoundedBelow | ( | const Point< T > & | bound | ) | const |
bool MFM::Point< T >::BoundedBy | ( | const Point< T > & | lowerBound, |
const Point< T > & | upperBound | ||
) | const |
Checks to see that the coordinates in this Point are bounded both by a Point representing a lower bound and a Point representing an upper bound; i.e.
lowerBound | The Point representing the lower bound of this test. |
upperBound | The Point representing the upper bound of this test. |
true
if this Point is bounded by the two parameters, else false
.
|
inline |
Sets the held coordinates of this Point to 0
.
void MFM::Point< T >::Divide | ( | T | scalar | ) |
bool MFM::Point< T >::Equals | ( | const Point< T > & | rhs | ) | const |
double MFM::Point< T >::GetEuclideanLength | ( | ) | const |
u32 MFM::Point< T >::GetManhattanLength | ( | ) | const |
u32 MFM::Point< T >::GetMaximumLength | ( | ) | const |
Gets the maximum of the x and y coordinates and returns the largest one; i.e. MAX(x,y)
.
T MFM::Point< T >::GetX | ( | ) | const |
T MFM::Point< T >::GetY | ( | ) | const |
|
inline |
void MFM::Point< T >::Mod | ( | T | scalar | ) |
void MFM::Point< T >::Multiply | ( | T | scalar | ) |
|
inline |
|
inline |
|
inline |
|
inline |
Point< T > & MFM::Point< T >::operator= | ( | const Point< T > & | rhs | ) |
void MFM::Point< T >::Parse | ( | char * | buffer | ) |
Parses a char* for a Point of {integral} type in the format "(x,y)" with no whitespace. This treats any read values as (T)atoi(x) and (T)atoi(y), so make sure that casting from a call of atoi won't break anything.
buffer | The char* to parse a point directly from. |
void MFM::Point< T >::Set | ( | T | x, |
T | y | ||
) |
void MFM::Point< T >::Set | ( | const Point< T > & | copyFrom | ) |
void MFM::Point< T >::SetX | ( | T | x | ) |
void MFM::Point< T >::SetY | ( | T | y | ) |
void MFM::Point< T >::Subtract | ( | const Point< T > & | offset | ) |
void MFM::Point< T >::Subtract | ( | T | x, |
T | y | ||
) |
Creates a Point consisting of the maximum x coordinate of two Points and the maximum y coordinate of two Points.
lhs | One of the Points used to construct this maximum Point . |
rhs | The other Point used to construct this maximum Point . |
lhs
and rhs
. Creates a Point consisting of the minimum x coordinate of two Points and the minimum y coordinate of two Points.
lhs | One of the Points used to construct this minimum Point . |
rhs | The other Point used to construct this minimum Point . |
lhs
and rhs
. Constructs a new Point consisting of the remainder of the division between coordinates of one Point and an integral scalar.
lhs | The dividend Point used to construct the new Point . |
rhs | The divisor scalar used to construct the new Point . |
lhs
and the scalar rhs
. Constructs a new Point consisting of the coordinates of one Point multiplied by an integral scalar.
lhs | The multiplicand Point used to construct the new Point . |
rhs | The multiplier scalar used to construc the new Point |
lhs
and the scalar rhs
. Creates a new Point consisting of the difference of the coordinates of two given points.
lhs | The minuend Point used to construct the differenced Point . |
rhs | The subtrahend Point used to construct the summed Point . |
lhs
and rhs
. Constructs a new Point consisting of the coordinates of one Point divided by an integral scalar.
lhs | The dividend Point used to construct the new Point . |
rhs | The divisor scalar used to construct the new Point . |
lhs
and the scalar rhs
.