Logo  0.95.0-final
Finite Element Embedded Library and Language in C++
Feel++ Feel++ on Github Feel++ community
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Feel::Sphere Class Reference

#include <sphere.hpp>

Detailed Description

This class defines a sphere. It also computes coordinate transformations between cartesian $ (x, y, z) $ and spherical $ (r, \theta, \phi) $ coordinates. The spherical coordinates are valid in the ranges:

  • $ 0 \le r < \infty $
  • $ 0 \le \theta < \pi $
  • $ 0 \le \phi < 2\pi $

The coordinates are related as follows: $ \phi $ is the angle in the xy plane starting with 0. from the positive x axis, $ \theta $ is measured against the positive z axis.

\      | Z
\theta|
\    |    .
\   |   .
\  |  .
\ | .
\|.
---------------+---------.---------
/|\       .          Y
/phi\     .
/  |  \   .
/   |   \ .
/.........\
/     |
X /
Author
Benjamin S. Kirk, Daniel Dreyer, 2002-2003
Christophe Prud'homme, 2005
Date
2002-2003
+ Inheritance diagram for Feel::Sphere:

Public Member Functions

Constructors, destructor
 Sphere ()
 
 Sphere (Sphere const &s)
 
 Sphere (const Point &c, const double r)
 
 ~Sphere ()
 
Accessors
double radius () const
 
const Pointcenter () const
 
Mutators
void setCenter (Point const &p)
 
void setRadius (double r)
 
Methods
void createFromCenterRadius (const Point &c, const double r)
 
bool intersects (const Sphere &other_sphere) const
 
bool aboveSurface (const Point &p) const
 
bool belowSurface (const Point &p) const
 
bool onSurface (const Point &p) const
 
Point closestPoint (const Point &p) const
 
Point unitNormal (const Point &p) const
 
Point surfaceCoords (const Point &cart) const
 
Point worldCoords (const Point &sph) const
 
- Public Member Functions inherited from Feel::Surface
 Surface ()
 
 Surface (const Surface &)
 
virtual ~Surface ()
 

Member Function Documentation

bool Feel::Sphere::aboveSurface ( const Point p) const
inlinevirtual
Returns
true if the point p is above the surface, false otherwise.

Implements Feel::Surface.

References center(), and radius().

bool Feel::Sphere::belowSurface ( const Point p) const
inlinevirtual
Returns
true if the point p is below the surface, false otherwise.

Implements Feel::Surface.

References aboveSurface().

const Point& Feel::Sphere::center ( ) const
inline
Returns
the center of the sphere.
Point Feel::Sphere::closestPoint ( const Point p) const
inlinevirtual
Returns
the closest point on the surface to point p.

Implements Feel::Surface.

References center(), Feel::Geo0D< Dim, T >::node(), radius(), and unitNormal().

void Feel::Sphere::createFromCenterRadius ( const Point c,
const double  r 
)
inline

Defines a sphere of radius r centered at c.

References setCenter(), and setRadius().

bool Feel::Sphere::intersects ( const Sphere other_sphere) const
inline
Returns
true if other_sphere intersects this sphere, false otherwise.

References center(), and radius().

bool Feel::Sphere::onSurface ( const Point p) const
inlinevirtual
Returns
true if the point p is on the surface, false otherwise. Note that the definition of on the surface really means "very close" to account for roundoff error.

Implements Feel::Surface.

References center(), and radius().

double Feel::Sphere::radius ( ) const
inline

Returns the radius of the sphere.

void Feel::Sphere::setCenter ( Point const &  p)
inline

set the center.

void Feel::Sphere::setRadius ( double  r)
inline

set the radius

Point Feel::Sphere::surfaceCoords ( const Point cart) const
inlinevirtual
Returns
the spherical coordinates for the cartesian coordinates cart.

Reimplemented from Feel::Surface.

References center(), and Feel::Geo0D< Dim, T >::node().

Point Feel::Sphere::unitNormal ( const Point p) const
inlinevirtual
Returns
a unit vector normal to the surface at point p.

Implements Feel::Surface.

References center(), and Feel::Geo0D< Dim, T >::node().

Point Feel::Sphere::worldCoords ( const Point sph) const
inlinevirtual
Returns
the cartesian coordinates for the spherical coordinates sph.

Reimplemented from Feel::Surface.

References center().


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

Generated on Fri Oct 25 2013 14:24:32 for Feel++ by doxygen 1.8.4