13 #ifndef OGLPLUS_MATH_SPHERE_1310040710_HPP
14 #define OGLPLUS_MATH_SPHERE_1310040710_HPP
19 #include <type_traits>
49 assert(_radius >=
T(0));
60 assert(_radius >=
T(0));
69 assert(_radius >=
T(0));
99 return _radius ==
T(0);
117 assert(_radius >=
T(0));
127 assert(amount >=
T(0));
137 assert(amount >=
T(0));
138 assert(amount <=
Radius());
148 assert(amount >=
T(0));
161 #if OGLPLUS_DOCUMENTATION_ONLY
169 T d = this->_radius + that._radius;
170 return Distance(this->_center, that._center) < d;
174 #if OGLPLUS_DOCUMENTATION_ONLY || defined(GL_FLOAT)
175 typedef Sphere<GLfloat>
Spheref;
179 template <
typename T>
187 #endif // include guard
Definition: vector.hpp:14
bool IntersectsWith(const Sphere &that) const
Returns true if this sphere intersects with that sphere.
Definition: sphere.hpp:167
void Translate(const Vector< T, 3 > &offset)
Translates the sphere to a new position by offset.
Definition: sphere.hpp:85
void Scale(T amount)
Scales the sphere by the specified amount.
Definition: sphere.hpp:146
T Radius(void) const
Returns the radius of the sphere.
Definition: sphere.hpp:106
Sphere(const Sphere< U > &that)
Copy construction from angles using different underlying type.
Definition: sphere.hpp:65
T Diameter(void) const
Returns the diameter of the sphere.
Definition: sphere.hpp:156
friend bool Intersecting(const Sphere &a, const Sphere &b)
Returns true if spheres a and b are intersecting.
Definition: sphere.hpp:180
bool Degenerate(void) const
Returns true if the sphere is degenerate (has zero radius)
Definition: sphere.hpp:97
Sphere(const Vector< T, 3 > &position, T radius)
Constructs a sphere with the specified radius at the position.
Definition: sphere.hpp:56
void Grow(T amount)
Grows the sphere by the specified amount.
Definition: sphere.hpp:125
void Shrink(T amount)
Shrinks the sphere by the specified amount.
Definition: sphere.hpp:135
Sphere(void)
Constructs a unit sphere at the origin.
Definition: sphere.hpp:36
Sphere< GLfloat > Spheref
Instantiation of Sphere using GL floating-point as underlying type.
Definition: sphere.hpp:176
void Radius(T radius)
Sets the radius of the sphere.
Definition: sphere.hpp:115
const Vector< T, 3 > & Center(void) const
Returns the position of the center of the sphere.
Definition: sphere.hpp:73
Class implementing sphere-related functionality.
Definition: sphere.hpp:29
void Center(const Vector< T, 3 > &position)
Sets the position of the sphere.
Definition: sphere.hpp:79
Definition: vector.hpp:14
void Transform(const Matrix< T, 4, 4 > &matrix)
Transforms the spheres origin by the specified matrix.
Definition: sphere.hpp:91
Sphere(T x, T y, T z, T r)
Constructs a sphere at the specified position and the specified radius.
Definition: sphere.hpp:45