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/develop/src/axom/primal/geometry/Sphere.hpp>
template<typename T, int NDIMS>
class axom::primal::Sphere< T, NDIMS >
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.
- Template Parameters
-
| T | the coordinate type, e.g., double, float, etc. |
| NDIMS | the number of dimensions |
◆ PointType
template<typename T , int NDIMS>
◆ Sphere() [1/3]
template<typename T , int NDIMS>
Constructs a Sphere centered at origin with the given radius.
- Parameters
-
| [in] | radius | the radius of the Sphere (optional). |
- Note
- If a radius is not supplied, the default radius is 1.0.
◆ Sphere() [2/3]
template<typename T , int NDIMS>
Constructs a Sphere with the given center and radius.
- Parameters
-
| [in] | center | user-supplied center. |
| [in] | radius | the radius of the Sphere (optional). |
- Note
- If a radius is not supplied, the default radius is 1.0.
◆ Sphere() [3/3]
template<typename T , int NDIMS>
Constructs a Sphere with the given center and radius.
- Parameters
-
| [in] | center | user-supplied center. |
| [in] | radius | the radius of the Sphere (optional). |
- Note
- If a radius is not supplied, the default radius is 1.0.
- Precondition
- center != nullptr
References SLIC_ASSERT.
◆ getRadius()
template<typename T , int NDIMS>
Returns the radius of the Sphere.
- Returns
- r the radius of the Sphere.
◆ getCenter()
template<typename T , int NDIMS>
Returns the center of the Sphere.
- Returns
- c pointer to array that holds the center of the Sphere.
- Note
- c points to an array that is NDIMS long.
- Postcondition
- c != nullptr
◆ getVolume()
template<typename T , int NDIMS>
Returns the n-dimensional volume enclosed by the Sphere.
◆ computeSignedDistance()
template<typename T , int NDIMS>
Computes the signed distance of a point to the Sphere's boundary.
- Parameters
-
- Returns
- d the computed signed distance of the point q to the sphere.
- Note
- The signed distance of a point q is:
-
negative inside the sphere
-
positive outside the sphere
-
zero on the boundary
References axom::primal::Vector< T, NDIMS >::norm().
◆ getOrientation()
template<typename T , int NDIMS>
◆ contains() [1/2]
template<typename T , int NDIMS>
Tests if a point lies inside this sphere.
- Parameters
-
| [in] | q | The test point |
| [in] | includeBoundary | should points on the boundary count as contained? (default true) |
- Returns
- true if q lies inside (and possibly on) the sphere, false otherwise.
- Note
- This is an exact-arithmetic-free containment test. When a tolerance-aware answer is required (for example, to treat points within EPS of the surface as lying on the boundary), use getOrientation(), which returns primal::ON_BOUNDARY within the supplied tolerance, or compare the result of computeSignedDistance() against your own scale-aware tolerance.
◆ intersectsWith()
template<typename T , int NDIMS>
◆ contains() [2/2]
template<typename T , int NDIMS>
◆ print()
template<typename T , int NDIMS>
Prints the Sphere information in the given output stream.
- Parameters
-
| [in,out] | os | the output stream to write to. |
- Note
- This method is primarily used for debugging.
- Returns
- s the modified output stream object.
The documentation for this class was generated from the following file:
- /home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/develop/src/axom/primal/geometry/Sphere.hpp