|
FifeGUI 0.2.0
A C++ GUI library designed for games.
|
#include <point.hpp>
Public Member Functions | |
| int | length () const |
| void | normalize () |
| bool | operator!= (Point const &p) const |
| Point | operator* (int const &i) const |
| Point | operator+ (Point const &p) const |
| Point & | operator+= (Point const &p) |
| Point | operator- (Point const &p) const |
| Point & | operator-= (Point const &p) |
| Point | operator/ (int const &i) const |
| Point & | operator= (Point &&rhs) noexcept |
| Point & | operator= (Point const &rhs) |
| bool | operator== (Point const &p) const |
| int & | operator[] (int ind) |
| Point (int _x=0, int _y=0) | |
| Point (Point &&rhs) noexcept | |
| Point (Point const &rhs) | |
| void | rotate (double angle) |
| void | rotate (Point const &origin, int angle) |
| Point | rotated (int angle) const |
| void | set (int _x, int _y) |
Public Attributes | |
| union { | |
| struct { | |
| int x | |
| int y | |
| } | |
| std::array< int, 2 > val | |
| }; | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, Point const &p) |
Represents a 2D coordinate (X, Y).
This is a small helper class to aid in 2d vector arithmetics.
|
inlineexplicit |
Constructor.
Creates a with 0 as default values.
Definition at line 45 of file point.hpp.
Referenced by operator!=(), operator*(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator<<, operator=(), operator=(), operator==(), Point(), Point(), rotate(), and rotated().
|
inline |
|
inlinenoexcept |
|
inline |
Return length.
Definition at line 150 of file point.hpp.
References fcn::Math< float >::Sqrt().
Referenced by normalize().
|
inline |
Normalizes the point.
Definition at line 159 of file point.hpp.
References length(), and fcn::Math< float >::zeroTolerance().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Rotates the point around the origin by angle degrees.
Definition at line 189 of file point.hpp.
References fcn::Math< double >::Cos(), fcn::Math< double >::pi(), and fcn::Math< double >::Sin().
|
inline |
Rotates the point around a given origin by angle degrees.
Coordinates stored as int. Uses float math internally. Results are rounded to nearest integer.
Definition at line 209 of file point.hpp.
References fcn::Math< double >::Cos(), fcn::Math< double >::pi(), Point(), and fcn::Math< double >::Sin().
|
inline |
Rotates the point around the origin by angle degrees.
Definition at line 176 of file point.hpp.
References fcn::Math< double >::Cos(), fcn::Math< double >::pi(), Point(), and fcn::Math< double >::Sin().
|
inline |
|
friend |