VTK-m  2.0
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

VTKM_EXEC_CONT Sphere ()
 Construct a default sphere (unit radius at the origin). More...
 
VTKM_EXEC_CONT Sphere (const Vector &center, CoordType radius)
 Construct a sphere from a center point and radius. More...
 
VTKM_EXEC_CONT bool IsValid () const
 Return true if the sphere is valid (i.e., has a strictly positive radius). More...
 
VTKM_EXEC_CONT bool Contains (const Vector &point, CoordType tol2=0.f) const
 Return whether the point lies strictly inside the sphere. More...
 
VTKM_EXEC_CONT 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...
 
VTKM_EXEC_CONT Sphere ()
 Construct sphere with center at (0,0,0) and radius = 0.5. More...
 
VTKM_EXEC_CONT Sphere (Scalar radius)
 Construct a sphere with center at (0,0,0) and the given radius. More...
 
VTKM_EXEC_CONT Sphere (Vector center, Scalar radius)
 
VTKM_CONT void SetRadius (Scalar radius)
 
VTKM_CONT void SetCenter (const Vector &center)
 
VTKM_EXEC_CONT Scalar GetRadius () const
 
const VTKM_EXEC_CONT VectorGetCenter () const
 
VTKM_EXEC_CONT Scalar Value (const Vector &point) const
 
VTKM_EXEC_CONT Vector Gradient (const Vector &point) const
 

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/5]

VTKM_EXEC_CONT vtkm::Sphere::Sphere ( )

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

◆ Sphere() [2/5]

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

Construct a sphere from a center point and radius.

◆ Sphere() [3/5]

VTKM_EXEC_CONT vtkm::Sphere::Sphere ( )
inline

Construct sphere with center at (0,0,0) and radius = 0.5.

◆ Sphere() [4/5]

VTKM_EXEC_CONT vtkm::Sphere::Sphere ( Scalar  radius)
inlineexplicit

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

◆ Sphere() [5/5]

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

Member Function Documentation

◆ Classify()

VTKM_EXEC_CONT 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()

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

Return whether the point lies strictly inside the sphere.

◆ GetCenter()

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

◆ GetRadius()

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

◆ Gradient()

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

◆ IsValid()

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

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

◆ SetCenter()

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

◆ SetRadius()

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

◆ Value()

VTKM_EXEC_CONT Scalar vtkm::Sphere::Value ( const Vector point) const
inline

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: