forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkExtractPolyDataGeometry.h
140 lines (118 loc) · 4.38 KB
/
vtkExtractPolyDataGeometry.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*=========================================================================
Program: Visualization Toolkit
Module: vtkExtractPolyDataGeometry.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 vtkExtractPolyDataGeometry
* @brief extract vtkPolyData cells that lies either entirely inside or outside of a specified implicit function
*
*
* vtkExtractPolyDataGeometry extracts from its input vtkPolyData all cells
* that are either completely inside or outside of a specified implicit
* function. This filter is specialized to vtkPolyData. On output the
* filter generates vtkPolyData.
*
* To use this filter you must specify an implicit function. You must also
* specify whether to extract cells laying inside or outside of the implicit
* function. (The inside of an implicit function is the negative values
* region.) An option exists to extract cells that are neither inside nor
* outside (i.e., boundary).
*
* Note that this filter also has the option to directly pass all points or cull
* the points that do not satisfy the implicit function test. Passing all points
* is a tad faster, but then points remain that do not pass the test and may mess
* up subsequent glyphing operations and so on. By default points are culled.
*
* A more general version of this filter is available for arbitrary
* vtkDataSet input (see vtkExtractGeometry).
*
* @sa
* vtkExtractGeometry vtkClipPolyData
*/
#ifndef vtkExtractPolyDataGeometry_h
#define vtkExtractPolyDataGeometry_h
#include "vtkFiltersExtractionModule.h" // For export macro
#include "vtkPolyDataAlgorithm.h"
class vtkImplicitFunction;
class VTKFILTERSEXTRACTION_EXPORT vtkExtractPolyDataGeometry : public vtkPolyDataAlgorithm
{
public:
vtkTypeMacro(vtkExtractPolyDataGeometry,vtkPolyDataAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
/**
* Construct object with ExtractInside turned on.
*/
static vtkExtractPolyDataGeometry *New();
/**
* Return the MTime taking into account changes to the implicit function
*/
vtkMTimeType GetMTime();
//@{
/**
* Specify the implicit function for inside/outside checks.
*/
virtual void SetImplicitFunction(vtkImplicitFunction*);
vtkGetObjectMacro(ImplicitFunction,vtkImplicitFunction);
//@}
//@{
/**
* Boolean controls whether to extract cells that are inside of implicit
* function (ExtractInside == 1) or outside of implicit function
* (ExtractInside == 0).
*/
vtkSetMacro(ExtractInside,int);
vtkGetMacro(ExtractInside,int);
vtkBooleanMacro(ExtractInside,int);
//@}
//@{
/**
* Boolean controls whether to extract cells that are partially inside.
* By default, ExtractBoundaryCells is off.
*/
vtkSetMacro(ExtractBoundaryCells,int);
vtkGetMacro(ExtractBoundaryCells,int);
vtkBooleanMacro(ExtractBoundaryCells,int);
//@}
//@{
/**
* Boolean controls whether points are culled or simply passed through
* to the output.
*/
vtkSetMacro(PassPoints,int);
vtkGetMacro(PassPoints,int);
vtkBooleanMacro(PassPoints,int);
//@}
protected:
vtkExtractPolyDataGeometry(vtkImplicitFunction *f=NULL);
~vtkExtractPolyDataGeometry();
// Usual data generation method
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
vtkImplicitFunction *ImplicitFunction;
int ExtractInside;
int ExtractBoundaryCells;
int PassPoints;
vtkIdType InsertPointInMap(vtkIdType i, vtkPoints *inPts, vtkPoints *newPts, vtkIdType *pointMap);
private:
vtkExtractPolyDataGeometry(const vtkExtractPolyDataGeometry&) VTK_DELETE_FUNCTION;
void operator=(const vtkExtractPolyDataGeometry&) VTK_DELETE_FUNCTION;
};
//@{
/**
* When not passing points, have to use a point map to keep track of things.
*/
inline vtkIdType vtkExtractPolyDataGeometry::InsertPointInMap(vtkIdType i, vtkPoints *inPts,
vtkPoints *newPts, vtkIdType *pointMap)
{
double x[3];
inPts->GetPoint(i, x);
pointMap[i] = newPts->InsertNextPoint(x);
return pointMap[i];
}
//@}
#endif