![]() |
Gamedev Framework (gf)
0.14.0
A C++14 framework for 2D games
|
Utility class for manipulating circles. More...
#include <gf/Circ.h>
Public Member Functions | |
constexpr | Circ () noexcept |
Default constructor. More... | |
constexpr | Circ (const Vector< T, 2 > &circCenter, T circRadius) noexcept |
Construct the circle from center and radius. More... | |
constexpr Vector< T, 2 > | getTop () const noexcept |
Get the top of the circle. More... | |
constexpr Vector< T, 2 > | getBottom () const noexcept |
Get the bottom of the circle. More... | |
constexpr Vector< T, 2 > | getLeft () const noexcept |
Get the left of the circle. More... | |
constexpr Vector< T, 2 > | getRight () const noexcept |
Get the right of the circle. More... | |
![]() | |
constexpr | Ball () noexcept |
Default constructor. More... | |
constexpr | Ball (const Vector< T, N > &ballCenter, T ballRadius) noexcept |
Construct the ball from center and radius. More... | |
constexpr Vector< T, N > | getCenter () const noexcept |
Get the center of the ball. More... | |
constexpr T | getRadius () const noexcept |
Get the radius of the ball. More... | |
constexpr bool | isEmpty () const noexcept |
Check if the ball is empty. More... | |
bool | contains (const Vector< T, N > &point) const noexcept |
Check if a point is insied a ball's area. More... | |
bool | intersects (const Ball< T, N > &other) const noexcept |
Check the intersection between two balls. More... | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename T > | |
bool | operator== (const Circ< T > &lhs, const Circ< T > &rhs) |
Equality operator. More... | |
template<typename T > | |
bool | operator!= (const Circ< T > &lhs, const Circ< T > &rhs) |
Inequality operator. More... | |
template<typename Archive , typename T > | |
Archive & | operator| (Archive &ar, Circ< T > &circ) |
Serialize a circle. More... | |
![]() | |
constexpr bool | operator== (const Ball< T, N > &lhs, const Ball< T, N > &rhs) |
Equality operator. More... | |
constexpr bool | operator!= (const Ball< T, N > &lhs, const Ball< T, N > &rhs) |
Inequality operator. More... | |
Archive & | operator| (Archive &ar, Ball< T, N > &ball) |
Serialize a ball. More... | |
Additional Inherited Members | |
![]() | |
Vector< T, N > | center |
Center of the ball. More... | |
T | radius |
Radius of the ball. More... | |
Utility class for manipulating circles.
A circle is defined by its center and its radius. It is a very simple class defined for convenience, so its member variables (center
and radius
) are public and can be accessed directly.
gf::Circ is a template and may be used with any numeric type, but for simplicity, some common typedef are defined:
int
as T
unsigned
as T
std::size_t
as T
float
as T
double
as T
So that you don't have to care about the template syntax.
Usage example:
Default constructor.
Creates an empty circle (it is equivalent to calling Circ({ 0, 0 }, 0
).
|
inlinenoexcept |
Construct the circle from center and radius.
circCenter | Center of the circle |
circRadius | Radius of the circle |
Get the bottom of the circle.
Get the left of the circle.
Get the right of the circle.
Get the top of the circle.
Inequality operator.
lhs | First circle |
rhs | Second circle |
Equality operator.
lhs | First circle |
rhs | Second circle |
|
related |
Serialize a circle.
ar | The archive |
circ | The circle to serialize |