Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Sphere Class Reference

#include <Sphere.h>

Inheritance diagram for Sphere:

Inheritance graph
[legend]
Collaboration diagram for Sphere:

Collaboration graph
[legend]
List of all members.

Detailed Description

This class defines a sphere.

Functions are provided for evaluating the implicit surface function at a point in space as well as the gradient and Hessian.

Definition at line 18 of file Sphere.h.

Public Member Functions

 Sphere ()
 Creates the default sphere of radius 1 at the origin.

 Sphere (double r)
 Creates a sphere with radius r at the origin.

 Sphere (gmVector3 x, double r)
 Creates a sphere with radius r at position x.

virtual double proc (gmVector3 x)
 Evaluates the implicit function of a sphere: f(x) = ||x - m_x|| - R.

virtual gmVector3 grad (gmVector3 x)
 Evaluates the gradient of a sphere.

virtual gmMatrix3 hess (gmVector3 x)
 Returns the Hessian of a Geometric sphere:.

virtual Intervald proc (Box< double >)
 proc returns the evaluation of the function that defines the Implicit surface.

virtual Box3d grad (Box< double >)
virtual IMatrix3d hess (Box< double >)
virtual Intervald proct (Box< double >)
virtual Box3d gradt (Box< double >)
virtual void procq (gmVector3, double *)
 Evaluates df/dq f = (x-c).(x-c)^1/2 - r df/dc = -(x-c)/(((x-c).(x-c))^1/2) df/dr = -1.

virtual void getq (double *)
 Loads parameters into q.

virtual void _setq (double *)
 Loads parameters from q.

virtual int qlen ()
 Number of implicit model parameters for this implicit object including its children.

virtual void getqname (char **qn)
 Returns a list of parameter names.

virtual double area ()
 Determines the surface area of the Implicit.

virtual const char ** getPixmapXPM (const int &size) const
 Returns the Pixmap for the Surface as a char* in the XPM image format.

 MAKE_NAME ()

Protected Member Functions

void init (gmVector3, double)
 Called by the various constructors to allow for a single location for the init of a Sphere object.

Box3d m_xlrp (Intervald)
 Convenience function for the calculation of a LRP over a time interval for a particular m_x.

Intervald m_rlrp (Intervald)

Protected Attributes

gmVector3 m_x
 Center.

double m_r
 Radius.


Constructor & Destructor Documentation

Sphere::Sphere  ) 
 

Creates the default sphere of radius 1 at the origin.

Definition at line 27 of file Sphere.cpp.

References init().

Sphere::Sphere double  r  ) 
 

Creates a sphere with radius r at the origin.

Definition at line 36 of file Sphere.cpp.

References init().

Sphere::Sphere gmVector3  x,
double  r
 

Creates a sphere with radius r at position x.

Definition at line 45 of file Sphere.cpp.

References init().


Member Function Documentation

void Sphere::_setq double *  q  )  [virtual]
 

Loads parameters from q.

Reimplemented from Implicit.

Reimplemented in Point.

Definition at line 262 of file Sphere.cpp.

References m_r, and m_x.

virtual double Sphere::area  )  [inline, virtual]
 

Determines the surface area of the Implicit.

For now, -1 means area cannot be calculated.

Returns:
-1 if area cannot be calculated
Todo:
implement this

Reimplemented from Implicit.

Definition at line 53 of file Sphere.h.

References M_PI, and m_r.

const char ** Sphere::getPixmapXPM const int &  size  )  const [virtual]
 

Returns the Pixmap for the Surface as a char* in the XPM image format.

This is a icon that can be used to represent the implicit in a GUI environment.

Reimplemented from Implicit.

Definition at line 282 of file Sphere.cpp.

void Sphere::getq double *  q  )  [virtual]
 

Loads parameters into q.

Reimplemented from Implicit.

Reimplemented in Point.

Definition at line 251 of file Sphere.cpp.

References m_r, and m_x.

void Sphere::getqname char **  qn  )  [virtual]
 

Returns a list of parameter names.

Parameters:
qn an array of size qlen of strings listing names of parameters

Reimplemented from Implicit.

Reimplemented in Point.

Definition at line 274 of file Sphere.cpp.

Box3d Sphere::grad Box< double >   )  [virtual]
 

Reimplemented from Implicit.

Definition at line 165 of file Sphere.cpp.

References convert(), Intervald, Interval< Type >::isZero(), Box< double >::lengthSquared(), m_x, m_xlrp(), and Interval< Type >::sqrt().

gmVector3 Sphere::grad gmVector3  x  )  [virtual]
 

Evaluates the gradient of a sphere.

Parameters:
x Point at which to evaluate gradient.
Returns:
Gradient vector.

Reimplemented from Implicit.

Definition at line 97 of file Sphere.cpp.

References m_x.

Box3d Sphere::gradt Box< double >  x  )  [virtual]
 

Todo:
Fix me!

Reimplemented from Implicit.

Definition at line 223 of file Sphere.cpp.

IMatrix3d Sphere::hess Box< double >   )  [virtual]
 

Reimplemented from Implicit.

Definition at line 190 of file Sphere.cpp.

References Intervald, Interval< Type >::isZero(), Box< double >::lengthSquared(), Interval< Type >::pow(), and Interval< Type >::sqrt().

gmMatrix3 Sphere::hess gmVector3  x  )  [virtual]
 

Returns the Hessian of a Geometric sphere:.

f(X) = (x*x + y*y + z*z)^1/2 - r df/dx = 2x * 1/2(x*x + y*y + z*z)^-1/2 grad f = x/(X.X)^1/2 d^2f/dx^2 = 1/(X.X)^1/2 - x^2/(X.X)^3/2 d^2f/dxdy = -xy/(X.X)^3/2

Parameters:
x Position irrelevant for a sphere.
Returns:
Hessian matrix.

Reimplemented from Implicit.

Definition at line 119 of file Sphere.cpp.

void Sphere::init gmVector3  x,
double  r
[protected]
 

Called by the various constructors to allow for a single location for the init of a Sphere object.

Definition at line 18 of file Sphere.cpp.

References m_r, and m_x.

Referenced by Sphere().

Intervald Sphere::m_rlrp Intervald   )  [protected]
 

Definition at line 70 of file Sphere.cpp.

References Implicit::getqold(), Intervald, m_r, and qlen().

Referenced by proc().

Box3d Sphere::m_xlrp Intervald  t  )  [protected]
 

Convenience function for the calculation of a LRP over a time interval for a particular m_x.

We use the "current" and the "last" coefficients to calculate an interval of the coefficients over a given time interval. This is used for 4D critical point finding.

Definition at line 57 of file Sphere.cpp.

References Intervald, m_x, and qlen().

Referenced by grad(), and proc().

Sphere::MAKE_NAME  ) 
 

Reimplemented in Point.

Intervald Sphere::proc Box< double >  x  )  [virtual]
 

proc returns the evaluation of the function that defines the Implicit surface.

In normal circumstances, the gmVector3 version of proc defaults to a pure virtual function which means that you must define proc(gmVector3) in its subclasses. When INTERVAL_EVAL_ONLY is defined, the Implicit version of proc defaults to a pure virtual function and the gmVector3 version calls the Interval version. Either way, you must define proc() in subclasses of Implicit.

Parameters:
x Where to evaluate the function.
Returns:
The function result. The function is positive outside the surface and negative inside.

Reimplemented from Implicit.

Definition at line 141 of file Sphere.cpp.

References convert(), Intervald, Box< double >::length(), m_r, m_rlrp(), m_x, and m_xlrp().

double Sphere::proc gmVector3  x  )  [virtual]
 

Evaluates the implicit function of a sphere: f(x) = ||x - m_x|| - R.

Parameters:
x Point at which to evaluate function.
Returns:
Function value.

Implements Implicit.

Definition at line 87 of file Sphere.cpp.

References m_r, and m_x.

void Sphere::procq gmVector3  x,
double *  dfdq
[virtual]
 

Evaluates df/dq f = (x-c).(x-c)^1/2 - r df/dc = -(x-c)/(((x-c).(x-c))^1/2) df/dr = -1.

Reimplemented from Implicit.

Definition at line 234 of file Sphere.cpp.

References m_x.

Intervald Sphere::proct Box< double >  x  )  [virtual]
 

Todo:
Fix me!

Reimplemented from Implicit.

Definition at line 215 of file Sphere.cpp.

References Intervald.

virtual int Sphere::qlen  )  [inline, virtual]
 

Number of implicit model parameters for this implicit object including its children.

Reimplemented from Implicit.

Reimplemented in Point.

Definition at line 49 of file Sphere.h.

Referenced by m_rlrp(), and m_xlrp().


Member Data Documentation

double Sphere::m_r [protected]
 

Radius.

Definition at line 22 of file Sphere.h.

Referenced by _setq(), area(), getq(), init(), m_rlrp(), and proc().

gmVector3 Sphere::m_x [protected]
 

Center.

Definition at line 21 of file Sphere.h.

Referenced by _setq(), Point::_setq(), getq(), Point::getq(), grad(), init(), m_xlrp(), proc(), and procq().


The documentation for this class was generated from the following files:
Generated on Mon Jun 28 15:03:14 2004 for Advanced Surface Library by doxygen 1.3.4