library of assembled shared sources

http://lass.cocamware.com

lass::prim::Sphere3D< T > Struct Template Reference

3D Sphere More...

#include <sphere_3d.h>


Data Structures

struct  Rebind

Public Types

enum  { dimension = TPoint::dimension }
typedef Sphere3D< T > TSelf
typedef Point3D< T > TPoint
typedef TPoint::TVector TVector
typedef TPoint::TValue TValue
typedef TPoint::TParam TParam
typedef TPoint::TReference TReference
typedef TPoint::TConstReference TConstReference
typedef TPoint::TNumTraits TNumTraits

Public Member Functions

 Sphere3D ()
 Sphere3D (const Point3D< T > &iCenter, TParam iRadius)
const TPointcenter () const
TPointcenter ()
TConstReference radius () const
TReference radius ()
const TValue area () const
 return area of surface of sphere
const TValue volume () const
 return volume of sphere
const Side classify (const TPoint &iPoint) const
 Classify a point and tell and what side of the sphere surface it is.
const TValue equation (const TPoint &iPoint) const
 (P - C)² - r²
const TValue signedDistance (const TPoint &iPoint) const
 return signed distance of point to surface of sphere.
const TValue squaredDistance (const TPoint &iPoint) const
 return squared distance of point to surface of sphere.
const bool contains (const TPoint &iPoint) const
 returns if point is on inside or on surface
const Side classify (const TPoint &iPoint, TParam iRelativeTolerance) const
 Classify a point and tell and what side of the sphere surface it is.
const TValue equation (const TPoint &iPoint, TParam iRelativeTolerance) const
 (P - C)² - r²
const TValue signedDistance (const TPoint &iPoint, TParam iRelativeTolerance) const
 return signed distance of point to surface of sphere.
const TValue squaredDistance (const TPoint &iPoint, TParam iRelativeTolerance) const
 return squared distance of point to surface of sphere.
const bool contains (const TPoint &iPoint, TParam iRelativeTolerance) const
 returns if point is on inside or on surface
const bool isValid () const
 return true if sphere has a non-negative radius

Private Attributes

TPoint center_
 center of sphere
TValue radius_
 radius of sphere

Related Functions

(Note that these are not member functions.)

template<typename T >
Aabb3D< T > aabb (const Sphere3D< T > &sphere)
template<typename T , typename MMP >
const bool intersects (const Sphere3D< T > &sphere, const Aabb3D< T, MMP > &aabb)
template<typename T , typename MMP >
const bool collides (const Sphere3D< T > &sphere, const Aabb3D< T, MMP > &aabb)
template<typename T >
const T squaredDistance (const Sphere3D< T > &sphere, const Point3D< T > &point)
template<typename T >
const T distance (const Sphere3D< T > &sphere, const Point3D< T > &point)
template<typename T >
std::ostream & operator<< (std::ostream &ioOStream, const Sphere3D< T > &iSphere)
template<typename T >
io::XmlOStreamoperator<< (io::XmlOStream &ioOStream, const Sphere3D< T > &iSphere)


Detailed Description

template<typename T>
struct lass::prim::Sphere3D< T >

3D Sphere

Author:
Bram de Greve
Date:
2002-2003

Definition at line 75 of file sphere_3d.h.


Member Typedef Documentation

template<typename T >
typedef Sphere3D<T> lass::prim::Sphere3D< T >::TSelf

Definition at line 79 of file sphere_3d.h.

template<typename T >
typedef Point3D<T> lass::prim::Sphere3D< T >::TPoint

Definition at line 81 of file sphere_3d.h.

template<typename T >
typedef TPoint::TVector lass::prim::Sphere3D< T >::TVector

Definition at line 82 of file sphere_3d.h.

template<typename T >
typedef TPoint::TValue lass::prim::Sphere3D< T >::TValue

Definition at line 84 of file sphere_3d.h.

template<typename T >
typedef TPoint::TParam lass::prim::Sphere3D< T >::TParam

Definition at line 85 of file sphere_3d.h.

template<typename T >
typedef TPoint::TReference lass::prim::Sphere3D< T >::TReference

Definition at line 86 of file sphere_3d.h.

template<typename T >
typedef TPoint::TConstReference lass::prim::Sphere3D< T >::TConstReference

Definition at line 87 of file sphere_3d.h.

template<typename T >
typedef TPoint::TNumTraits lass::prim::Sphere3D< T >::TNumTraits

Definition at line 88 of file sphere_3d.h.


Member Enumeration Documentation

template<typename T >
anonymous enum

Enumerator:
dimension 

Definition at line 90 of file sphere_3d.h.


Constructor & Destructor Documentation

template<typename T >
lass::prim::Sphere3D< T >::Sphere3D (  )  [inline]

template<typename T >
lass::prim::Sphere3D< T >::Sphere3D ( const Point3D< T > &  iCenter,
TParam  iRadius 
)


Member Function Documentation

template<typename T >
const Sphere3D< T >::TPoint & lass::prim::Sphere3D< T >::center (  )  const [inline]

template<typename T >
Sphere3D< T >::TPoint & lass::prim::Sphere3D< T >::center (  )  [inline]

Definition at line 89 of file sphere_3d.inl.

References lass::prim::Sphere3D< T >::center_.

template<typename T >
Sphere3D< T >::TConstReference lass::prim::Sphere3D< T >::radius (  )  const [inline]

template<typename T >
Sphere3D< T >::TReference lass::prim::Sphere3D< T >::radius (  )  [inline]

Definition at line 107 of file sphere_3d.inl.

References lass::prim::Sphere3D< T >::radius_.

template<typename T >
const Sphere3D< T >::TValue lass::prim::Sphere3D< T >::area (  )  const [inline]

return area of surface of sphere

Definition at line 118 of file sphere_3d.inl.

References lass::num::NumTraits< C >::pi, lass::prim::Sphere3D< T >::radius_, and sqr().

template<typename T >
const Sphere3D< T >::TValue lass::prim::Sphere3D< T >::volume (  )  const [inline]

return volume of sphere

Definition at line 129 of file sphere_3d.inl.

References lass::num::NumTraits< C >::pi, lass::prim::Sphere3D< T >::radius_, and lass::num::sqr().

template<typename T >
const Side lass::prim::Sphere3D< T >::classify ( const TPoint iPoint  )  const [inline]

Classify a point and tell and what side of the sphere surface it is.

Returns:
sInside, sSurface, sOutside

Definition at line 140 of file sphere_3d.inl.

References lass::prim::Sphere3D< T >::equation(), lass::prim::sInside, lass::prim::sOutside, lass::prim::sSurface, and lass::num::NumTraits< C >::zero.

template<typename T >
const Sphere3D< T >::TValue lass::prim::Sphere3D< T >::equation ( const TPoint iPoint  )  const [inline]

template<typename T >
const Sphere3D< T >::TValue lass::prim::Sphere3D< T >::signedDistance ( const TPoint iPoint  )  const [inline]

return signed distance of point to surface of sphere.

negative distance means point is inside the sphere.

Definition at line 166 of file sphere_3d.inl.

References lass::prim::Sphere3D< T >::equation(), sqrt(), and lass::num::NumTraits< C >::zero.

template<typename T >
const Sphere3D< T >::TValue lass::prim::Sphere3D< T >::squaredDistance ( const TPoint iPoint  )  const [inline]

return squared distance of point to surface of sphere.

Definition at line 178 of file sphere_3d.inl.

References lass::num::abs(), and lass::prim::Sphere3D< T >::equation().

Referenced by lass::prim::Sphere3D< T >::distance(), and lass::prim::Sphere3D< T >::squaredDistance().

template<typename T >
const bool lass::prim::Sphere3D< T >::contains ( const TPoint iPoint  )  const [inline]

returns if point is on inside or on surface

Returns:
classify(iPoint) != sOutside but may be faster

Definition at line 189 of file sphere_3d.inl.

References lass::prim::Sphere3D< T >::equation(), and lass::num::NumTraits< C >::zero.

template<typename T >
const Side lass::prim::Sphere3D< T >::classify ( const TPoint iPoint,
TParam  iRelativeTolerance 
) const [inline]

Classify a point and tell and what side of the sphere surface it is.

Returns:
sInside, sSurface, sOutside

Definition at line 201 of file sphere_3d.inl.

References lass::prim::Sphere3D< T >::equation(), lass::prim::sInside, lass::prim::sOutside, lass::prim::sSurface, and lass::num::NumTraits< C >::zero.

template<typename T >
const Sphere3D< T >::TValue lass::prim::Sphere3D< T >::equation ( const TPoint iPoint,
TParam  iRelativeTolerance 
) const [inline]

template<typename T >
const Sphere3D< T >::TValue lass::prim::Sphere3D< T >::signedDistance ( const TPoint iPoint,
TParam  iRelativeTolerance 
) const [inline]

return signed distance of point to surface of sphere.

negative distance means point is inside the sphere.

Definition at line 229 of file sphere_3d.inl.

References lass::prim::Sphere3D< T >::equation(), sqrt(), and lass::num::NumTraits< C >::zero.

template<typename T >
const Sphere3D< T >::TValue lass::prim::Sphere3D< T >::squaredDistance ( const TPoint iPoint,
TParam  iRelativeTolerance 
) const [inline]

return squared distance of point to surface of sphere.

Definition at line 241 of file sphere_3d.inl.

References lass::num::abs(), and lass::prim::Sphere3D< T >::equation().

template<typename T >
const bool lass::prim::Sphere3D< T >::contains ( const TPoint iPoint,
TParam  iRelativeTolerance 
) const [inline]

returns if point is on inside or on surface

Returns:
classify(iPoint, iRelativeTolerance) != sOutside but may be faster

Definition at line 252 of file sphere_3d.inl.

References lass::prim::Sphere3D< T >::equation(), and lass::num::NumTraits< C >::zero.

template<typename T >
const bool lass::prim::Sphere3D< T >::isValid (  )  const [inline]

return true if sphere has a non-negative radius

Definition at line 263 of file sphere_3d.inl.

References lass::prim::Sphere3D< T >::radius_, and lass::num::NumTraits< C >::zero.


Friends And Related Function Documentation

template<typename T >
Aabb3D< T > aabb ( const Sphere3D< T > &  sphere  )  [related]

template<typename T , typename MMP >
const bool intersects ( const Sphere3D< T > &  sphere,
const Aabb3D< T, MMP > &  aabb 
) [related]

See also:
lass::prim::Aabb3D

Definition at line 100 of file aabb_3d_sphere_3d.h.

References lass::prim::intersects().

template<typename T , typename MMP >
const bool collides ( const Sphere3D< T > &  sphere,
const Aabb3D< T, MMP > &  aabb 
) [related]

See also:
lass::prim::Aabb3D

Definition at line 125 of file aabb_3d_sphere_3d.h.

References lass::prim::collides().

template<typename T >
const T squaredDistance ( const Sphere3D< T > &  sphere,
const Point3D< T > &  point 
) [related]

Definition at line 283 of file sphere_3d.inl.

References lass::prim::Sphere3D< T >::squaredDistance().

template<typename T >
const T distance ( const Sphere3D< T > &  sphere,
const Point3D< T > &  point 
) [related]

Definition at line 293 of file sphere_3d.inl.

References sqrt(), and lass::prim::Sphere3D< T >::squaredDistance().

template<typename T >
std::ostream & operator<< ( std::ostream &  ioOStream,
const Sphere3D< T > &  iSphere 
) [related]

Definition at line 303 of file sphere_3d.inl.

References LASS_ENFORCE.

template<typename T >
io::XmlOStream & operator<< ( io::XmlOStream ioOStream,
const Sphere3D< T > &  iSphere 
) [related]

Definition at line 314 of file sphere_3d.inl.

References LASS_ENFORCE_STREAM.


Field Documentation

template<typename T >
TPoint lass::prim::Sphere3D< T >::center_ [private]

template<typename T >
TValue lass::prim::Sphere3D< T >::radius_ [private]


The documentation for this struct was generated from the following files:

Generated on Mon Nov 10 14:22:14 2008 for Library of Assembled Shared Sources by doxygen 1.5.7.1
SourceForge.net Logo