Feel++ 0.111.0-preview.14
Finite Element Embedded Library in C++
Feel::Sphere Class Reference

This class defines a sphere. More...

+ Inheritance diagram for Feel::Sphere:
+ Collaboration diagram for Feel::Sphere:

Methods

void createFromCenterRadius (const Point &c, const double r)
 Defines a sphere of radius r centered at c.
 
bool intersects (const Sphere &other_sphere) const
 
bool aboveSurface (const Point &p) const override
 
bool belowSurface (const Point &p) const override
 
bool onSurface (const Point &p) const override
 
Point closestPoint (const Point &p) const override
 
Point unitNormal (const Point &p) const override
 
Point surfaceCoords (const Point &cart) const override
 
Point worldCoords (const Point &sph) const override
 

Constructors, destructor

 Sphere ()
 
 Sphere (Sphere const &s)
 
 Sphere (const Point &c, const double r)
 
 ~Sphere () override
 

Accessors

double radius () const
 Returns the radius of the sphere.
 
const Point & center () const
 

Mutators

void setCenter (Point const &p)
 set the center.
 
void setRadius (double r)
 set the radius
 

Additional Inherited Members

- Public Member Functions inherited from Feel::Surface
 Surface ()
 Constructor. More...
 
 Surface (const Surface &)
 Copy-constructor.
 
virtual ~Surface ()
 Destructor.
 

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

Member Function Documentation

◆ aboveSurface()

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

Implements Feel::Surface.

References center(), and radius().

Referenced by belowSurface().

◆ belowSurface()

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

Implements Feel::Surface.

References aboveSurface().

◆ center()

const Point & Feel::Sphere::center ( ) const
Returns
the center of the sphere.

Referenced by aboveSurface(), closestPoint(), intersects(), onSurface(), unitNormal(), and worldCoords().

◆ closestPoint()

Point Feel::Sphere::closestPoint ( const Point &  p) const
overridevirtual
Returns
the closest point on the surface to point p.

Implements Feel::Surface.

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

◆ intersects()

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

References center(), and radius().

◆ onSurface()

bool Feel::Sphere::onSurface ( const Point &  p) const
overridevirtual
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().

◆ surfaceCoords()

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

Reimplemented from Feel::Surface.

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

◆ unitNormal()

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

Implements Feel::Surface.

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

Referenced by closestPoint().

◆ worldCoords()

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

Reimplemented from Feel::Surface.

References center().