AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
|
Defines an oriented Sphere in 2-D (i.e., a circle) or 3-D given by its center, \( \mathcal{X} \) and radius \( \mathcal{R} \). The Sphere object provides associated operations on a sphere, such as, signed distance and orientation. More...
#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.5.0/src/axom/primal/geometry/Sphere.hpp>
Public Member Functions | |
~Sphere () | |
Destructor. More... | |
T | getRadius () const |
Returns the radius of the Sphere. More... | |
const T * | getCenter () const |
Returns the center of the Sphere. More... | |
T | computeSignedDistance (const T *q) const |
Computes the signed distance of a point to the Sphere's boundary. More... | |
int | getOrientation (const T *q, double TOL=1.e-9) const |
Computes the orientation of a point with respect to the Sphere. More... | |
bool | intersectsWith (const Sphere< T, NDIMS > &sphere, double TOL=1.e-9) const |
Tests if this sphere instance intersects with another sphere. More... | |
std::ostream & | print (std::ostream &os) const |
Prints the Sphere information in the given output stream. More... | |
Constructors | |
Sphere (T radius=1.0) | |
Constructs a Sphere centered at origin with the given radius. More... | |
Sphere (const T *center, T radius=1.0) | |
Constructs a Sphere with the given center and radius. More... | |
Defines an oriented Sphere in 2-D (i.e., a circle) or 3-D given by its center, \( \mathcal{X} \) and radius \( \mathcal{R} \). The Sphere object provides associated operations on a sphere, such as, signed distance and orientation.
T | the coordinate type, e.g., double, float, etc. |
NDIMS | the number of dimensions |
|
explicit |
Constructs a Sphere centered at origin with the given radius.
[in] | radius | the radius of the Sphere (optional). |
References AXOM_STATIC_ASSERT_MSG.
|
explicit |
Constructs a Sphere with the given center and radius.
[in] | center | user-supplied center. |
[in] | radius | the radius of the Sphere (optional). |
References AXOM_STATIC_ASSERT_MSG, and SLIC_ASSERT.
axom::primal::Sphere< T, NDIMS >::~Sphere | ( | ) |
Destructor.
|
inline |
Returns the radius of the Sphere.
Referenced by axom::primal::Sphere< T, NDIMS >::intersectsWith().
|
inline |
Returns the center of the Sphere.
References axom::primal::Sphere< T, NDIMS >::computeSignedDistance(), axom::primal::Sphere< T, NDIMS >::getOrientation(), axom::primal::Sphere< T, NDIMS >::intersectsWith(), and axom::primal::Sphere< T, NDIMS >::print().
Referenced by axom::primal::Sphere< T, NDIMS >::intersectsWith().
|
inline |
Computes the signed distance of a point to the Sphere's boundary.
[in] | q | pointer to buffer consisting of query point coordinates. |
References SLIC_ASSERT.
Referenced by axom::primal::Sphere< T, NDIMS >::getCenter(), and axom::primal::Sphere< T, NDIMS >::getOrientation().
|
inline |
Computes the orientation of a point with respect to the Sphere.
[in] | q | pointer to user-supplied point q. |
[in] | TOL | user-supplied tolerance. Optional. Default is 1.e-9. |
q
is on the sphere's boundary q
is outside the sphere q
is inside the sphere References axom::primal::Sphere< T, NDIMS >::computeSignedDistance(), axom::utilities::isNearlyEqual(), axom::primal::ON_BOUNDARY, axom::primal::ON_NEGATIVE_SIDE, axom::primal::ON_POSITIVE_SIDE, and SLIC_ASSERT.
Referenced by axom::primal::Sphere< T, NDIMS >::getCenter().
|
inline |
Tests if this sphere instance intersects with another sphere.
[in] | sphere | the sphere object to check for intersection |
[in] | TOL | tolerance for intersection test. Optional. If not specified the default tolerance is set to 1.e-9. |
References axom::numerics::dot_product(), axom::primal::Sphere< T, NDIMS >::getCenter(), axom::primal::Sphere< T, NDIMS >::getRadius(), and axom::utilities::isNearlyEqual().
Referenced by axom::primal::Sphere< T, NDIMS >::getCenter(), and axom::primal::intersect().
std::ostream & axom::primal::Sphere< T, NDIMS >::print | ( | std::ostream & | os | ) | const |
Prints the Sphere information in the given output stream.
[in,out] | os | the output stream to write to. |
Referenced by axom::primal::Sphere< T, NDIMS >::getCenter().