# Visualization Library

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

[Home] [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 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

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

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

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

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

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

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

- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlCore/Sphere.hpp

Visualization Library v2011.05.1142 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 26 2011 22:51:36.
Permission is granted to use this page to write and publish articles regarding Visualization Library.