forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkSpheres.h
119 lines (100 loc) · 3.31 KB
/
vtkSpheres.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*=========================================================================
Program: Visualization Toolkit
Module: vtkSpheres.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkSpheres
* @brief implicit function for a set of spheres
*
* vtkSpheres computes the implicit function and function gradient for a set
* of spheres. The spheres are combined via a union operation (i.e., the
* minimum value from the evaluation of all spheres is taken).
*
* The function value is the distance of a point to the closest sphere, with
* negative values interior to the spheres, positive outside the spheres, and
* distance=0 on the spheres surface. The function gradient is the sphere
* normal at the function value.
*
* @sa
* vtkPlanes vtkImplicitBoolean
*/
#ifndef vtkSpheres_h
#define vtkSpheres_h
#include "vtkCommonDataModelModule.h" // For export macro
#include "vtkImplicitFunction.h"
class vtkSphere;
class vtkPoints;
class vtkDataArray;
class VTKCOMMONDATAMODEL_EXPORT vtkSpheres : public vtkImplicitFunction
{
public:
//@{
/**
* Standard methods for instantiation, type information, and printing.
*/
static vtkSpheres *New();
vtkTypeMacro(vtkSpheres,vtkImplicitFunction);
void PrintSelf(ostream& os, vtkIndent indent) override;
//@}
//@{
/**
* Evaluate spheres equations. Return largest value when evaluating all
* sphere equations.
*/
using vtkImplicitFunction::EvaluateFunction;
double EvaluateFunction(double x[3]) override;
//@}
/**
* Evaluate spheres gradient. Gradients point towards the outside of the
* spheres.
*/
void EvaluateGradient(double x[3], double n[3]) override;
//@{
/**
* Specify a list of points defining sphere centers.
*/
virtual void SetCenters(vtkPoints*);
vtkGetObjectMacro(Centers,vtkPoints);
//@}
//@{
/**
* Specify a list of radii for the spheres. There is a one-to-one
* correspondence between sphere points and sphere radii.
*/
void SetRadii(vtkDataArray* radii);
vtkGetObjectMacro(Radii,vtkDataArray);
//@}
/**
* Return the number of spheres in the set of spheres.
*/
int GetNumberOfSpheres();
/**
* Create and return a pointer to a vtkSphere object at the ith
* position. Asking for a sphere outside the allowable range returns
* nullptr. This method always returns the same object. Alternatively use
* GetSphere(int i, vtkSphere *sphere) to update a user supplied sphere.
*/
vtkSphere *GetSphere(int i);
/**
* If i is within the allowable range, mutates the given sphere's
* Center and Radius to match the vtkSphere object at the ith
* position. Does nothing if i is outside the allowable range.
*/
void GetSphere(int i, vtkSphere *sphere);
protected:
vtkSpheres();
~vtkSpheres() override;
vtkPoints *Centers;
vtkDataArray *Radii;
vtkSphere *Sphere;
private:
vtkSpheres(const vtkSpheres&) = delete;
void operator=(const vtkSpheres&) = delete;
};
#endif