OGLplus (0.52.0) a C++ wrapper for OpenGL

oglplus::Sphere< T > Class Template Reference

Class implementing sphere-related functionality. More...

#include </home/chochlik/devel/oglplus/include/oglplus/math/sphere.hpp>

Public Member Functions

 Sphere (void)
 Constructs a unit sphere at the origin.
 
 Sphere (T x, T y, T z, T r)
 Constructs a sphere at the specified position and the specified radius. More...
 
 Sphere (const Vector< T, 3 > &position, T radius)
 Constructs a sphere with the specified radius at the position. More...
 
template<typename U >
 Sphere (const Sphere< U > &that)
 Copy construction from angles using different underlying type.
 
const Vector< T, 3 > & Center (void) const
 Returns the position of the center of the sphere.
 
void Center (const Vector< T, 3 > &position)
 Sets the position of the sphere.
 
void Translate (const Vector< T, 3 > &offset)
 Translates the sphere to a new position by offset.
 
void Transform (const Matrix< T, 4, 4 > &matrix)
 Transforms the spheres origin by the specified matrix.
 
bool Degenerate (void) const
 Returns true if the sphere is degenerate (has zero radius)
 
T Radius (void) const
 Returns the radius of the sphere. More...
 
void Radius (T radius)
 Sets the radius of the sphere. More...
 
void Grow (T amount)
 Grows the sphere by the specified amount. More...
 
void Shrink (T amount)
 Shrinks the sphere by the specified amount. More...
 
void Scale (T amount)
 Scales the sphere by the specified amount. More...
 
T Diameter (void) const
 Returns the diameter of the sphere. More...
 
bool IntersectsWith (const Sphere &that) const
 Returns true if this sphere intersects with that sphere.
 

Friends

bool Intersecting (const Sphere &a, const Sphere &b)
 Returns true if spheres a and b are intersecting.
 

Detailed Description

template<typename T>
class oglplus::Sphere< T >

Class implementing sphere-related functionality.

Sphere is a lightweight class for working with spheres.

Constructor & Destructor Documentation

template<typename T>
oglplus::Sphere< T >::Sphere ( T  x,
T  y,
T  z,
T  r 
)

Constructs a sphere at the specified position and the specified radius.

Precondition
r >= 0
template<typename T>
oglplus::Sphere< T >::Sphere ( const Vector< T, 3 > &  position,
T  radius 
)

Constructs a sphere with the specified radius at the position.

Precondition
radius >= 0

Member Function Documentation

template<typename T>
T oglplus::Sphere< T >::Diameter ( void  ) const

Returns the diameter of the sphere.

Postcondition
Diameter() >= 0
template<typename T>
void oglplus::Sphere< T >::Grow ( T  amount)

Grows the sphere by the specified amount.

Precondition
amount >= 0
template<typename T>
T oglplus::Sphere< T >::Radius ( void  ) const

Returns the radius of the sphere.

Postcondition
Radius() >= 0

Referenced by oglplus::Sphere< GLfloat >::Diameter(), and oglplus::Sphere< GLfloat >::Shrink().

template<typename T>
void oglplus::Sphere< T >::Radius ( T  radius)

Sets the radius of the sphere.

Precondition
radius >= 0
template<typename T>
void oglplus::Sphere< T >::Scale ( T  amount)

Scales the sphere by the specified amount.

Precondition
amount >= 0
template<typename T>
void oglplus::Sphere< T >::Shrink ( T  amount)

Shrinks the sphere by the specified amount.

Precondition
(amount >= 0) && (amount <= this->Radius())

The documentation for this class was generated from the following file:
  • /home/chochlik/devel/oglplus/include/oglplus/math/sphere.hpp

Copyright © 2010-2014 Matúš Chochlík, University of Žilina, Žilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Mon Sep 22 2014 by Doxygen (version 1.8.6).