![]() |
Gamedev Framework (gf)
0.3.0
A C++11 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 > | getCenter () const noexcept |
| Get the center of the circle. More... | |
| constexpr T | getRadius () const noexcept |
| Get the radius of the circle. More... | |
| constexpr bool | isEmpty () const noexcept |
| Check if the circle is empty. 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... | |
| bool | contains (const Vector< T, 2 > &point) const noexcept |
| Check if a point is insied a circle's area. More... | |
| bool | intersects (const Circ< T > &other) const noexcept |
| Check the intersection between two circles. More... | |
Public Attributes | |
| Vector< T, 2 > | center |
| Center of the circle. More... | |
| T | radius |
| Radius of the circle. 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... | |
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 Tunsigned as Tstd::size_t as Tfloat as TSo that you don't have to care about the temlate 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 |
|
inlinenoexcept |
Check if a point is insied a circle's area.
| point | Point to test |
Get the bottom of the circle.
Get the center of the circle.
It is a synonym for the center member
Get the left of the circle.
Get the radius of the circle.
It is a synonym for the radius member
Get the right of the circle.
Get the top of the circle.
|
inlinenoexcept |
Check the intersection between two circles.
| other | Circle to test |
Check if the circle is empty.
An empty circle is a circle with a zero radius.
Inequality operator.
| lhs | First circle |
| rhs | Second circle |
Equality operator.
| lhs | First circle |
| rhs | Second circle |
1.8.8