VTK: Common/DataModel/vtkSphere.h Source File

| VTK 9.3.1

vtkSphere.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
25 #ifndef vtkSphere_h
26 #define vtkSphere_h
27
28 #include "vtkCommonDataModelModule.h" // For export macro
29 #include "vtkImplicitFunction.h"
30
31 VTK_ABI_NAMESPACE_BEGIN
32 class VTKCOMMONDATAMODEL_EXPORT vtkSphere : public vtkImplicitFunction
33 {
34 public:
35 vtkTypeMacro(vtkSphere, vtkImplicitFunction);
36 void PrintSelf(ostream& os, vtkIndent indent) override;
37
41 static vtkSphere* New();
42
44
47 using vtkImplicitFunction::EvaluateFunction;
48 double EvaluateFunction(double x[3]) override;
50
54 void EvaluateGradient(double x[3], double n[3]) override;
55
57
60 vtkSetMacro(Radius, double);
61 vtkGetMacro(Radius, double);
63
65
68 vtkSetVector3Macro(Center, double);
69 vtkGetVectorMacro(Center, double, 3);
71
75 static double Evaluate(double center[3], double R, double x[3])
76 {
77 return (x[0] - center[0]) * (x[0] - center[0]) + (x[1] - center[1]) * (x[1] - center[1]) +
78 (x[2] - center[2]) * (x[2] - center[2]) - R * R;
79 }
80
82
90 static void ComputeBoundingSphere(
91 float* pts, vtkIdType numPts, float sphere[4], vtkIdType hints[2]);
92 static void ComputeBoundingSphere(
93 double* pts, vtkIdType numPts, double sphere[4], vtkIdType hints[2]);
95
97
105 static void ComputeBoundingSphere(
106 float** spheres, vtkIdType numSpheres, float sphere[4], vtkIdType hints[2]);
107 static void ComputeBoundingSphere(
108 double** spheres, vtkIdType numSpheres, double sphere[4], vtkIdType hints[2]);
110
111 protected:
112 vtkSphere();
113 ~vtkSphere() override = default;
114
115 double Radius;
116 double Center[3];
117
118 private:
119 vtkSphere(const vtkSphere&) = delete;
120 void operator=(const vtkSphere&) = delete;
121 };
122
123 VTK_ABI_NAMESPACE_END
124 #endif
vtkImplicitFunction
abstract interface for implicit functions
Definition: vtkImplicitFunction.h:59
vtkImplicitFunction::EvaluateFunction
virtual double EvaluateFunction(double x[3])=0
Evaluate function at position x-y-z and return value.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkSphere
implicit function for a sphere
Definition: vtkSphere.h:33
vtkSphere::EvaluateGradient
void EvaluateGradient(double x[3], double n[3]) override
Evaluate sphere gradient.
vtkSphere::Evaluate
static double Evaluate(double center[3], double R, double x[3])
Quick evaluation of the sphere equation ((x-x0)^2 + (y-y0)^2 + (z-z0)^2) - R^2.
Definition: vtkSphere.h:75
vtkSphere::Radius
double Radius
Definition: vtkSphere.h:115
vtkSphere::~vtkSphere
~vtkSphere() override=default
vtkSphere::vtkSphere
vtkSphere()
vtkSphere::ComputeBoundingSphere
static void ComputeBoundingSphere(double **spheres, vtkIdType numSpheres, double sphere[4], vtkIdType hints[2])
Create a bounding sphere from a set of spheres.
vtkSphere::ComputeBoundingSphere
static void ComputeBoundingSphere(double *pts, vtkIdType numPts, double sphere[4], vtkIdType hints[2])
Create a bounding sphere from a set of points.
vtkSphere::EvaluateFunction
double EvaluateFunction(double x[3]) override
Evaluate sphere equation ((x-x0)^2 + (y-y0)^2 + (z-z0)^2) - R^2.
vtkSphere::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSphere::New
static vtkSphere * New()
Construct sphere with center at (0,0,0) and radius=0.5.
vtkSphere::ComputeBoundingSphere
static void ComputeBoundingSphere(float *pts, vtkIdType numPts, float sphere[4], vtkIdType hints[2])
Create a bounding sphere from a set of points.
vtkSphere::ComputeBoundingSphere
static void ComputeBoundingSphere(float **spheres, vtkIdType numSpheres, float sphere[4], vtkIdType hints[2])
Create a bounding sphere from a set of spheres.
vtkX3D::center
@ center
Definition: vtkX3D.h:230
vtkImplicitFunction.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315