Public Member Functions | Private Attributes
vgl_sphere_3d< Type > Class Template Reference

Represents a cartesian 3D point. More...

#include <vgl_sphere_3d.h>

List of all members.

Public Member Functions

 vgl_sphere_3d ()
 Default constructor.
 vgl_sphere_3d (Type px, Type py, Type pz, Type rad)
 Construct from four scalars: centre and radius.
 vgl_sphere_3d (const Type v[4])
 Construct from a 4-array, representing centre and radius.
 vgl_sphere_3d (vgl_point_3d< Type > const &cntr, Type rad)
 Construct from centre point and radius.
bool operator== (const vgl_sphere_3d< Type > &s) const
 Test for equality.
bool operator!= (vgl_sphere_3d< Type >const &s) const
 Test for inequality.
const vgl_point_3d< Type > & centre () const
Type radius () const
bool is_empty () const
 Return true if this sphere is empty.
bool contains (vgl_point_3d< Type > const &p) const
 Return true iff the point p is inside (or on) this sphere.
void set_empty ()
 Make the sphere empty.
void set_radius (Type r)
 Set radius r of this sphere (while centre unchanged).
void set_centre (const vgl_point_3d< Type > &c)
 Set centre of this sphere to c (while radius unchanged).
bool clip (const vgl_line_3d_2_points< Type > &line, vgl_point_3d< Type > &p1, vgl_point_3d< Type > &p2) const
 Calculate the end points of a line clipped by this sphere.
vcl_ostream & print (vcl_ostream &os) const
 Writes "<vgl_sphere_3d centre=vgl_point_3d<x,y,z> radius=r)>" to stream.
vcl_istream & read (vcl_istream &is)
 Read from stream, possibly with formatting.

Private Attributes

vgl_point_3d< Type > c_
 centre
Type r_
 radius

Detailed Description

template<class Type>
class vgl_sphere_3d< Type >

Represents a cartesian 3D point.

Definition at line 18 of file vgl_sphere_3d.h.


Constructor & Destructor Documentation

template<class Type>
vgl_sphere_3d< Type >::vgl_sphere_3d ( ) [inline]

Default constructor.

Definition at line 27 of file vgl_sphere_3d.h.

template<class Type>
vgl_sphere_3d< Type >::vgl_sphere_3d ( Type  px,
Type  py,
Type  pz,
Type  rad 
) [inline]

Construct from four scalars: centre and radius.

Definition at line 30 of file vgl_sphere_3d.h.

template<class Type>
vgl_sphere_3d< Type >::vgl_sphere_3d ( const Type  v[4]) [inline]

Construct from a 4-array, representing centre and radius.

Definition at line 33 of file vgl_sphere_3d.h.

template<class Type>
vgl_sphere_3d< Type >::vgl_sphere_3d ( vgl_point_3d< Type > const &  cntr,
Type  rad 
) [inline]

Construct from centre point and radius.

Definition at line 36 of file vgl_sphere_3d.h.


Member Function Documentation

template<class Type>
const vgl_point_3d<Type>& vgl_sphere_3d< Type >::centre ( ) const [inline]

Definition at line 45 of file vgl_sphere_3d.h.

template<class Type>
bool vgl_sphere_3d< T >::clip ( const vgl_line_3d_2_points< Type > &  line,
vgl_point_3d< Type > &  p1,
vgl_point_3d< Type > &  p2 
) const

Calculate the end points of a line clipped by this sphere.

Returns:
true if any of the line touches the sphere.

Definition at line 30 of file vgl_sphere_3d.txx.

template<class Type>
bool vgl_sphere_3d< Type >::contains ( vgl_point_3d< Type > const &  p) const

Return true iff the point p is inside (or on) this sphere.

template<class Type>
bool vgl_sphere_3d< Type >::is_empty ( ) const [inline]

Return true if this sphere is empty.

Definition at line 49 of file vgl_sphere_3d.h.

template<class Type>
bool vgl_sphere_3d< Type >::operator!= ( vgl_sphere_3d< Type >const &  s) const [inline]

Test for inequality.

Definition at line 41 of file vgl_sphere_3d.h.

template<class Type>
bool vgl_sphere_3d< Type >::operator== ( const vgl_sphere_3d< Type > &  s) const [inline]

Test for equality.

Definition at line 39 of file vgl_sphere_3d.h.

template<class T >
vcl_ostream & vgl_sphere_3d< T >::print ( vcl_ostream &  os) const

Writes "<vgl_sphere_3d centre=vgl_point_3d<x,y,z> radius=r)>" to stream.

Definition at line 55 of file vgl_sphere_3d.txx.

template<class Type>
Type vgl_sphere_3d< Type >::radius ( ) const [inline]

Definition at line 46 of file vgl_sphere_3d.h.

template<class T >
vcl_istream & vgl_sphere_3d< T >::read ( vcl_istream &  is)

Read from stream, possibly with formatting.

Either just reads 4 blank-separated numbers, or reads 4 comma-separated numbers, or reads 4 numbers in parenthesized form "(123, 321, 567, 890)"

Definition at line 67 of file vgl_sphere_3d.txx.

template<class Type>
void vgl_sphere_3d< Type >::set_centre ( const vgl_point_3d< Type > &  c) [inline]

Set centre of this sphere to c (while radius unchanged).

Definition at line 62 of file vgl_sphere_3d.h.

template<class Type>
void vgl_sphere_3d< Type >::set_empty ( ) [inline]

Make the sphere empty.

Definition at line 57 of file vgl_sphere_3d.h.

template<class Type>
void vgl_sphere_3d< Type >::set_radius ( Type  r) [inline]

Set radius r of this sphere (while centre unchanged).

Definition at line 60 of file vgl_sphere_3d.h.


Member Data Documentation

template<class Type>
vgl_point_3d<Type> vgl_sphere_3d< Type >::c_ [private]

centre

Definition at line 20 of file vgl_sphere_3d.h.

template<class Type>
Type vgl_sphere_3d< Type >::r_ [private]

radius

Definition at line 21 of file vgl_sphere_3d.h.


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