Visualization Library v1.0.3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Attributes

vl::Sphere Class Reference

The Sphere class defines a sphere using a center and a radius using vl::real precision. More...

#include <Sphere.hpp>

List of all members.

Public Member Functions

 Sphere ()
 Constructor: creates a null sphere.
 Sphere (const vec3 &center, 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 &center)
 Sets the center of the sphere.
const vec3center () 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.
Sphereoperator= (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 Sphereoperator+= (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

Detailed Description

The Sphere class defines a sphere using a center and a radius using vl::real precision.

Definition at line 43 of file Sphere.hpp.


Constructor & Destructor Documentation

vl::Sphere::Sphere (  ) [inline]

Constructor: creates a null sphere.

Definition at line 47 of file Sphere.hpp.

vl::Sphere::Sphere ( const vec3 center,
real  radius 
) [inline]

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.


Member Function Documentation

void vl::Sphere::setNull (  ) [inline]

Sets the sphere as null.

Definition at line 56 of file Sphere.hpp.

Referenced by transformed().

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]
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]
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.

References mCenter, and mRadius.

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==().

Sphere& vl::Sphere::operator= ( const AABB aabb ) [inline]

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().

Sphere vl::Sphere::operator+ ( const Sphere other ) [inline]

Returns a sphere that contains the two specified spheres.

Definition at line 117 of file Sphere.hpp.

const Sphere& vl::Sphere::operator+= ( const Sphere other ) [inline]

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().

void vl::Sphere::transformed ( Sphere out,
const mat4 mat 
) const [inline]

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().

Sphere vl::Sphere::transformed ( const mat4 mat ) const [inline]

Returns a sphere that contains the original sphere transformed by the given matrix.

Definition at line 181 of file Sphere.hpp.


Member Data Documentation

Definition at line 189 of file Sphere.hpp.

Referenced by operator==(), and transformed().

Definition at line 190 of file Sphere.hpp.

Referenced by operator==(), and transformed().


The documentation for this class was generated from the following file:

Visualization Library v1.0.3 Reference Documentation
Copyright Michele Bosi. All rights reserved.
Updated on Tue Feb 7 2017 00:55:07.
Permission is granted to use this page to write and publish articles regarding Visualization Library.