VTK-m
2.2
|
Represent a sphere of the given Dimension. More...
#include <Geometry.h>
Public Types | |
using | Vector = vtkm::Vec< CoordType, Dim > |
Public Member Functions | |
Sphere () | |
Construct a default sphere (unit radius at the origin). More... | |
Sphere (const Vector ¢er, CoordType radius) | |
Construct a sphere from a center point and radius. More... | |
bool | IsValid () const |
Return true if the sphere is valid (i.e., has a strictly positive radius). More... | |
bool | Contains (const Vector &point, CoordType tol2=0.f) const |
Return whether the point lies strictly inside the sphere. More... | |
int | Classify (const Vector &point, CoordType tol2=0.f) const |
Classify a point as inside (-1), on (0), or outside (+1) of the sphere. More... | |
Sphere (Scalar radius=0.5) | |
Construct a sphere with center at (0,0,0) and the given radius. More... | |
Sphere (Vector center, Scalar radius) | |
Construct a sphere with the given center and radius. More... | |
void | SetRadius (Scalar radius) |
Specify the radius of the sphere. More... | |
void | SetCenter (const Vector ¢er) |
Specify the center of the sphere. More... | |
Scalar | GetRadius () const |
Specify the radius of the sphere. More... | |
const Vector & | GetCenter () const |
Specify the center of the sphere. More... | |
Scalar | Value (const Vector &point) const |
Evaluate the value of the implicit function. More... | |
Vector | Gradient (const Vector &point) const |
Evaluate the gradient of the implicit function. More... | |
Public Attributes | |
Vector | Center |
CoordType | Radius |
Static Public Attributes | |
static constexpr int | Dimension = Dim |
Private Attributes | |
Scalar | Radius |
Represent a sphere of the given Dimension.
Implicit function for a sphere.
If a constructor is given an invalid specification, then the Radius of the resulting sphere will be -1.
A sphere is defined by its center and a radius.
The value of the sphere implicit function is the square of the distance from the center biased by the radius (so the surface of the sphere is at value 0).
using vtkm::Sphere::Vector = vtkm::Vec<CoordType, Dim> |
vtkm::Sphere::Sphere | ( | ) |
Construct a default sphere (unit radius at the origin).
vtkm::Sphere::Sphere | ( | const Vector & | center, |
CoordType | radius | ||
) |
Construct a sphere from a center point and radius.
|
inlineexplicit |
Construct a sphere with center at (0,0,0) and the given radius.
|
inline |
Construct a sphere with the given center and radius.
int vtkm::Sphere::Classify | ( | const Vector & | point, |
CoordType | tol2 = 0.f |
||
) | const |
Classify a point as inside (-1), on (0), or outside (+1) of the sphere.
The tolerance tol2 is the maximum allowable difference in squared magnitude between the squared radius and the squared distance between the point and Center.
bool vtkm::Sphere::Contains | ( | const Vector & | point, |
CoordType | tol2 = 0.f |
||
) | const |
Return whether the point lies strictly inside the sphere.
|
inline |
Specify the center of the sphere.
|
inline |
Specify the radius of the sphere.
Evaluate the gradient of the implicit function.
The Gradient()
method for an implicit function takes a vtkm::Vec3f
and returns a vtkm::Vec3f
representing the pointing direction from the implicit function's shape. Gradient calculations are more object shape specific. It is advised to look at the individual shape implementations for specific implicit functions.
|
inline |
Return true if the sphere is valid (i.e., has a strictly positive radius).
|
inline |
Specify the center of the sphere.
|
inline |
Specify the radius of the sphere.
|
inline |
Evaluate the value of the implicit function.
The Value()
method for an implicit function takes a vtkm::Vec3f
and returns a vtkm::FloatDefault
representing the orientation of the point with respect to the implicit function's shape. Negative scalar values represent vector points inside of the implicit function's shape. Positive scalar values represent vector points outside the implicit function's shape. Zero values represent vector points that lie on the surface of the implicit function.
Vector vtkm::Sphere::Center |
|
staticconstexpr |
CoordType vtkm::Sphere::Radius |
|
private |