forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkQuadRotationalExtrusionFilter.h
182 lines (159 loc) · 5.49 KB
/
vtkQuadRotationalExtrusionFilter.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/*=========================================================================
Program: Visualization Toolkit
Module: vtkQuadRotationalExtrusionFilter.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 vtkQuadRotationalExtrusionFilter
* @brief sweep polygonal data creating "skirt" from free edges and lines, and lines from vertices
*
* vtkQuadRotationalExtrusionFilter is a modeling filter. It takes polygonal
* data as input and generates polygonal data on output. The input dataset
* is swept around the z-axis to create new polygonal primitives. These
* primitives form a "skirt" or swept surface. For example, sweeping a
* line results in a cylindrical shell, and sweeping a circle creates a
* torus.
*
* There are a number of control parameters for this filter. You can
* control whether the sweep of a 2D object (i.e., polygon or triangle
* strip) is capped with the generating geometry via the "Capping" instance
* variable. Also, you can control the angle of rotation, and whether
* translation along the z-axis is performed along with the rotation.
* (Translation is useful for creating "springs".) You also can adjust
* the radius of the generating geometry using the "DeltaRotation" instance
* variable.
*
* The skirt is generated by locating certain topological features. Free
* edges (edges of polygons or triangle strips only used by one polygon or
* triangle strips) generate surfaces. This is true also of lines or
* polylines. Vertices generate lines.
*
* This filter can be used to model axisymmetric objects like cylinders,
* bottles, and wine glasses; or translational/rotational symmetric objects
* like springs or corkscrews.
*
* @warning
* If the object sweeps 360 degrees, radius does not vary, and the object
* does not translate, capping is not performed. This is because the cap
* is unnecessary.
*
* @warning
* Some polygonal objects have no free edges (e.g., sphere). When swept,
* this will result in two separate surfaces if capping is on, or no surface
* if capping is off.
*
* @sa
* vtkLinearExtrusionFilter vtkRotationalExtrusionFilter
*
* @par Thanks:
* This class was initially developed by Daniel Aguilera, CEA/DIF
* Ported and modified by Philippe Pebay, Kitware, 2011
*/
#ifndef vtkQuadRotationalExtrusionFilter_h
#define vtkQuadRotationalExtrusionFilter_h
#include "vtkFiltersModelingModule.h" // For export macro
#include "vtkMultiBlockDataSetAlgorithm.h"
#include <map> // STL vector need for per block angles
class vtkPoints;
class vtkPointData;
class VTKFILTERSMODELING_EXPORT vtkQuadRotationalExtrusionFilter : public vtkMultiBlockDataSetAlgorithm
{
public:
vtkTypeMacro(vtkQuadRotationalExtrusionFilter,vtkMultiBlockDataSetAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
/**
* Create object with capping on, angle of 360 degrees, resolution = 12, and
* no translation along z-axis.
* vector (0,0,1), and point (0,0,0).
*/
static vtkQuadRotationalExtrusionFilter *New();
enum RotationAxis
{
USE_X = 0,
USE_Y = 1,
USE_Z = 2
};
//@{
/**
* Set the axis of rotation to use. It is set by default to Z.
*/
vtkSetClampMacro(Axis, int, 0, 2);
vtkGetMacro(Axis, int);
void SetAxisToX() { this->SetAxis(USE_X); };
void SetAxisToY() { this->SetAxis(USE_Y); };
void SetAxisToZ() { this->SetAxis(USE_Z); };
//@}
//@{
/**
* Set/Get resolution of sweep operation. Resolution controls the number
* of intermediate node points.
*/
vtkSetClampMacro(Resolution,int,1,VTK_INT_MAX);
vtkGetMacro(Resolution,int);
//@}
//@{
/**
* Turn on/off the capping of the skirt.
*/
vtkSetMacro(Capping,int);
vtkGetMacro(Capping,int);
vtkBooleanMacro(Capping,int);
//@}
//@{
/**
* Set/Get angle of rotation.
*/
vtkSetMacro(DefaultAngle,double);
vtkGetMacro(DefaultAngle,double);
//@}
//@{
/**
* Set/Get angles of rotation for each block in a composite data set.
*/
void RemoveAllPerBlockAngles();
void AddPerBlockAngle(vtkIdType blockId, double angle);
//@}
//@{
/**
* Set/Get total amount of translation along the z-axis.
*/
vtkSetMacro(Translation,double);
vtkGetMacro(Translation,double);
//@}
//@{
/**
* Set/Get change in radius during sweep process.
*/
vtkSetMacro(DeltaRadius,double);
vtkGetMacro(DeltaRadius,double);
//@}
protected:
vtkQuadRotationalExtrusionFilter();
~vtkQuadRotationalExtrusionFilter() {}
int FillInputPortInformation( int , vtkInformation* );
int RequestData( vtkInformation*,
vtkInformationVector**,
vtkInformationVector* );
int RotateAroundAxis( double,
vtkIdType,
vtkPoints*,
vtkPoints*,
vtkPointData*,
vtkPointData* );
int Axis;
int Resolution;
int Capping;
double DefaultAngle;
double Translation;
double DeltaRadius;
std::map<vtkIdType,double> PerBlockAngles;
private:
vtkQuadRotationalExtrusionFilter(const vtkQuadRotationalExtrusionFilter&) VTK_DELETE_FUNCTION;
void operator=(const vtkQuadRotationalExtrusionFilter&) VTK_DELETE_FUNCTION;
};
#endif