VTK
vtkSphere.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSphere.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
31 #ifndef vtkSphere_h
32 #define vtkSphere_h
33 
34 #include "vtkCommonDataModelModule.h" // For export macro
35 #include "vtkImplicitFunction.h"
36 
37 class VTKCOMMONDATAMODEL_EXPORT vtkSphere : public vtkImplicitFunction
38 {
39 public:
41  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
46  static vtkSphere *New();
47 
49 
53  double EvaluateFunction(double x[3]) override;
55 
59  void EvaluateGradient(double x[3], double n[3]) override;
60 
62 
65  vtkSetMacro(Radius,double);
66  vtkGetMacro(Radius,double);
68 
70 
73  vtkSetVector3Macro(Center,double);
74  vtkGetVectorMacro(Center,double,3);
76 
80  static double Evaluate(double center[3], double R, double x[3])
81  {return (x[0]-center[0])*(x[0]-center[0]) +
82  (x[1]-center[1])*(x[1]-center[1]) +
83  (x[2]-center[2])*(x[2]-center[2]) - R*R;
84  }
85 
87 
95  static void ComputeBoundingSphere(float *pts, vtkIdType numPts, float sphere[4],
96  vtkIdType hints[2]);
97  static void ComputeBoundingSphere(double *pts, vtkIdType numPts, double sphere[4],
98  vtkIdType hints[2]);
100 
102 
110  static void ComputeBoundingSphere(float **spheres, vtkIdType numSpheres, float sphere[4],
111  vtkIdType hints[2]);
112  static void ComputeBoundingSphere(double **spheres, vtkIdType numSpheres, double sphere[4],
113  vtkIdType hints[2]);
115 
116 protected:
117  vtkSphere();
118  ~vtkSphere() override {}
119 
120  double Radius;
121  double Center[3];
122 
123 private:
124  vtkSphere(const vtkSphere&) = delete;
125  void operator=(const vtkSphere&) = delete;
126 };
127 
128 #endif
abstract interface for implicit functions
virtual double EvaluateFunction(double x[3])=0
Evaluate function at position x-y-z and return value.
int vtkIdType
Definition: vtkType.h:347
virtual void EvaluateGradient(double x[3], double g[3])=0
Evaluate function gradient at position x-y-z and pass back vector.
implicit function for a sphere
Definition: vtkSphere.h:37
a simple class to control print indentation
Definition: vtkIndent.h:39
double Radius
Definition: vtkSphere.h:120
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:80
~vtkSphere() override
Definition: vtkSphere.h:118
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.