Visualization Library v1.0.3A lightweight C++ OpenGL middleware for 2D/3D graphics |
[Download] [Tutorials] [All Classes] [Grouped Classes] |
The Sphere class defines a sphere using a center and a radius using vl::real precision. More...
#include <Sphere.hpp>
Public Member Functions | |
Sphere () | |
Constructor: creates a null sphere. | |
Sphere (const vec3 ¢er, real radius) | |
Constructor: creates a sphere with the given center and radius. | |
Sphere (const AABB &aabb) | |
Copy-constructor. | |
void | setNull () |
Sets the sphere as null. | |
bool | isNull () const |
Returns true if the sphere is null, ie, if radius is < 0. | |
bool | isPoint () const |
Returns true if the sphere as radius == 0. | |
void | setCenter (const vec3 ¢er) |
Sets the center of the sphere. | |
const vec3 & | center () const |
Returns the center of the sphere. | |
void | setRadius (real radius) |
Sets the radius of the sphere. | |
real | radius () const |
Returns the radius of the sphere. | |
bool | includes (const Sphere &other) const |
Returns true if a sphere contains the specified sphere. | |
bool | operator== (const Sphere &other) const |
Returns true if two spheres are identical. | |
bool | operator!= (const Sphere &other) const |
Returns true if two spheres are not identical. | |
Sphere & | operator= (const AABB &aabb) |
Constructs a sphere that contains the specified AABB. | |
Sphere | operator+ (const Sphere &other) |
Returns a sphere that contains the two specified spheres. | |
const Sphere & | operator+= (const Sphere &other) |
Enlarges the sphere to contain the specified sphere. | |
void | transformed (Sphere &out, const mat4 &mat) const |
Returns a sphere that contains the original sphere transformed by the given matrix. | |
Sphere | transformed (const mat4 &mat) const |
Returns a sphere that contains the original sphere transformed by the given matrix. | |
Protected Attributes | |
vec3 | mCenter |
real | mRadius |
The Sphere class defines a sphere using a center and a radius using vl::real precision.
Definition at line 43 of file Sphere.hpp.
vl::Sphere::Sphere | ( | ) | [inline] |
Constructor: creates a null sphere.
Definition at line 47 of file Sphere.hpp.
Constructor: creates a sphere with the given center and radius.
Definition at line 50 of file Sphere.hpp.
vl::Sphere::Sphere | ( | const AABB & | aabb ) | [inline] |
Copy-constructor.
Definition at line 53 of file Sphere.hpp.
void vl::Sphere::setNull | ( | ) | [inline] |
bool vl::Sphere::isNull | ( | ) | const [inline] |
Returns true if the sphere is null, ie, if radius is < 0.
Definition at line 59 of file Sphere.hpp.
Referenced by vl::SceneManager::computeBounds(), vl::Camera::computeNearFarOptimizedProjMatrix(), vl::Frustum::cull(), includes(), and operator+=().
bool vl::Sphere::isPoint | ( | ) | const [inline] |
Returns true if the sphere as radius == 0.
Definition at line 62 of file Sphere.hpp.
void vl::Sphere::setCenter | ( | const vec3 & | center ) | [inline] |
Sets the center of the sphere.
Definition at line 65 of file Sphere.hpp.
Referenced by vl::SceneManager::computeBounds(), and vl::import_Sphere().
const vec3& vl::Sphere::center | ( | ) | const [inline] |
Returns the center of the sphere.
Definition at line 68 of file Sphere.hpp.
Referenced by vl::SceneManager::computeBounds(), vl::Camera::computeNearFarOptimizedProjMatrix(), vl::Frustum::cull(), vl::export_Sphere(), includes(), and operator+=().
void vl::Sphere::setRadius | ( | real | radius ) | [inline] |
Sets the radius of the sphere.
Definition at line 71 of file Sphere.hpp.
Referenced by vl::SceneManager::computeBounds(), and vl::import_Sphere().
real vl::Sphere::radius | ( | ) | const [inline] |
Returns the radius of the sphere.
Definition at line 74 of file Sphere.hpp.
Referenced by vl::Camera::adjustView(), vl::SceneManager::computeBounds(), vl::Camera::computeNearFarOptimizedProjMatrix(), vl::Frustum::cull(), vl::export_Sphere(), includes(), and operator+=().
bool vl::Sphere::includes | ( | const Sphere & | other ) | const [inline] |
Returns true if a sphere contains the specified sphere.
Definition at line 77 of file Sphere.hpp.
References center(), vl::distance(), isNull(), vl::length(), and radius().
Referenced by operator+=().
bool vl::Sphere::operator== | ( | const Sphere & | other ) | const [inline] |
Returns true if two spheres are identical.
Definition at line 92 of file Sphere.hpp.
bool vl::Sphere::operator!= | ( | const Sphere & | other ) | const [inline] |
Returns true if two spheres are not identical.
Definition at line 98 of file Sphere.hpp.
References vl::operator==().
Constructs a sphere that contains the specified AABB.
Definition at line 104 of file Sphere.hpp.
References vl::AABB::center(), vl::AABB::isNull(), vl::length(), vl::AABB::maxCorner(), and vl::AABB::minCorner().
Returns a sphere that contains the two specified spheres.
Definition at line 117 of file Sphere.hpp.
Enlarges the sphere to contain the specified sphere.
Definition at line 124 of file Sphere.hpp.
References center(), includes(), vl::Vector3< T_Scalar >::isNull(), isNull(), vl::length(), vl::Vector3< T_Scalar >::normalize(), and radius().
Returns a sphere that contains the original sphere transformed by the given matrix.
Definition at line 157 of file Sphere.hpp.
References mCenter, mRadius, setNull(), and vl::sqrt().
Referenced by vl::Camera::computeNearFarOptimizedProjMatrix().
Returns a sphere that contains the original sphere transformed by the given matrix.
Definition at line 181 of file Sphere.hpp.
vec3 vl::Sphere::mCenter [protected] |
Definition at line 189 of file Sphere.hpp.
Referenced by operator==(), and transformed().
real vl::Sphere::mRadius [protected] |
Definition at line 190 of file Sphere.hpp.
Referenced by operator==(), and transformed().