VTK-m  2.1
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes | List of all members
vtkm::Sphere Class Reference

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 &center, 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 &center)
 Specify the center of the sphere. More...
 
Scalar GetRadius () const
 Specify the radius of the sphere. More...
 
const VectorGetCenter () 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
 

Detailed Description

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).

Member Typedef Documentation

◆ Vector

using vtkm::Sphere::Vector = vtkm::Vec<CoordType, Dim>

Constructor & Destructor Documentation

◆ Sphere() [1/4]

vtkm::Sphere::Sphere ( )

Construct a default sphere (unit radius at the origin).

◆ Sphere() [2/4]

vtkm::Sphere::Sphere ( const Vector center,
CoordType  radius 
)

Construct a sphere from a center point and radius.

◆ Sphere() [3/4]

vtkm::Sphere::Sphere ( Scalar  radius = 0.5)
inlineexplicit

Construct a sphere with center at (0,0,0) and the given radius.

◆ Sphere() [4/4]

vtkm::Sphere::Sphere ( Vector  center,
Scalar  radius 
)
inline

Construct a sphere with the given center and radius.

Member Function Documentation

◆ Classify()

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.

◆ Contains()

bool vtkm::Sphere::Contains ( const Vector point,
CoordType  tol2 = 0.f 
) const

Return whether the point lies strictly inside the sphere.

◆ GetCenter()

const Vector& vtkm::Sphere::GetCenter ( ) const
inline

Specify the center of the sphere.

◆ GetRadius()

Scalar vtkm::Sphere::GetRadius ( ) const
inline

Specify the radius of the sphere.

◆ Gradient()

Vector vtkm::Sphere::Gradient ( const Vector point) const
inline

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.

◆ IsValid()

bool vtkm::Sphere::IsValid ( ) const
inline

Return true if the sphere is valid (i.e., has a strictly positive radius).

◆ SetCenter()

void vtkm::Sphere::SetCenter ( const Vector center)
inline

Specify the center of the sphere.

◆ SetRadius()

void vtkm::Sphere::SetRadius ( Scalar  radius)
inline

Specify the radius of the sphere.

◆ Value()

Scalar vtkm::Sphere::Value ( const Vector point) const
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.

Member Data Documentation

◆ Center

Vector vtkm::Sphere::Center

◆ Dimension

constexpr int vtkm::Sphere::Dimension = Dim
staticconstexpr

◆ Radius [1/2]

CoordType vtkm::Sphere::Radius

◆ Radius [2/2]

Scalar vtkm::Sphere::Radius
private

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