27 #include "Portability.h" 29 #include "VectorOps.h" 32 #ifndef DOXYGEN_SHOULD_SKIP_THIS 45 template<
typename T, std::
size_t N>
106 return radius ==
T(0);
117 return gf::squareDistance(center, point) <=
gf::square(radius);
128 return gf::squareDistance(center, other.center) <=
gf::square(radius + other.radius);
141 template<
typename T, std::
size_t N>
155 template<
typename T, std::
size_t N>
169 template<
typename Archive,
typename T, std::
size_t N>
174 #ifndef DOXYGEN_SHOULD_SKIP_THIS
constexpr Vector< T, N > getCenter() const noexcept
Get the center of the ball.
Definition: Ball.h:82
bool intersects(const Ball< T, N > &other) const noexcept
Check the intersection between two balls.
Definition: Ball.h:127
Archive & operator|(Archive &ar, Ball< T, N > &ball)
Serialize a ball.
Definition: Ball.h:170
A n-dimension ball.
Definition: Ball.h:46
constexpr T square(T val)
Square function.
Definition: Math.h:289
constexpr bool operator!=(const Ball< T, N > &lhs, const Ball< T, N > &rhs)
Inequality operator.
Definition: Ball.h:157
constexpr T getRadius() const noexcept
Get the radius of the ball.
Definition: Ball.h:94
The namespace for gf classes.
Definition: Action.h:35
constexpr bool operator==(const Ball< T, N > &lhs, const Ball< T, N > &rhs)
Equality operator.
Definition: Ball.h:143
T radius
Radius of the ball.
Definition: Ball.h:48
constexpr bool isEmpty() const noexcept
Check if the ball is empty.
Definition: Ball.h:105
constexpr Ball(const Vector< T, N > &ballCenter, T ballRadius) noexcept
Construct the ball from center and radius.
Definition: Ball.h:67
General purpose math vector.
Definition: Vector.h:61
Vector< T, N > center
Center of the ball.
Definition: Ball.h:47
bool contains(const Vector< T, N > &point) const noexcept
Check if a point is insied a ball's area.
Definition: Ball.h:116
constexpr Ball() noexcept
Default constructor.
Definition: Ball.h:55