VTK  9.3.20240328
vtkTubeFilter.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
158 #ifndef vtkTubeFilter_h
159 #define vtkTubeFilter_h
160 
161 #include "vtkFiltersCoreModule.h" // For export macro
162 #include "vtkPolyDataAlgorithm.h"
163 
164 #define VTK_VARY_RADIUS_OFF 0
165 #define VTK_VARY_RADIUS_BY_SCALAR 1
166 #define VTK_VARY_RADIUS_BY_VECTOR 2
167 #define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR 3
168 #define VTK_VARY_RADIUS_BY_VECTOR_NORM 4
169 
170 #define VTK_TCOORDS_OFF 0
171 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
172 #define VTK_TCOORDS_FROM_LENGTH 2
173 #define VTK_TCOORDS_FROM_SCALARS 3
174 
175 VTK_ABI_NAMESPACE_BEGIN
176 class vtkCellArray;
177 class vtkCellData;
178 class vtkDataArray;
179 class vtkFloatArray;
180 class vtkPointData;
181 class vtkPoints;
182 
183 class VTKFILTERSCORE_EXPORT vtkTubeFilter : public vtkPolyDataAlgorithm
184 {
185 public:
187  void PrintSelf(ostream& os, vtkIndent indent) override;
188 
193  static vtkTubeFilter* New();
194 
196 
199  vtkSetClampMacro(Radius, double, 0.0, VTK_DOUBLE_MAX);
200  vtkGetMacro(Radius, double);
202 
204 
207  vtkSetClampMacro(VaryRadius, int, VTK_VARY_RADIUS_OFF, VTK_VARY_RADIUS_BY_VECTOR_NORM);
208  vtkGetMacro(VaryRadius, int);
209  void SetVaryRadiusToVaryRadiusOff() { this->SetVaryRadius(VTK_VARY_RADIUS_OFF); }
213  {
214  this->SetVaryRadius(VTK_VARY_RADIUS_BY_VECTOR_NORM);
215  }
217  {
218  this->SetVaryRadius(VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR);
219  }
220  const char* GetVaryRadiusAsString();
222 
224 
227  vtkSetClampMacro(NumberOfSides, int, 3, VTK_INT_MAX);
228  vtkGetMacro(NumberOfSides, int);
230 
232 
235  vtkSetMacro(RadiusFactor, double);
236  vtkGetMacro(RadiusFactor, double);
238 
240 
244  vtkSetVector3Macro(DefaultNormal, double);
245  vtkGetVectorMacro(DefaultNormal, double, 3);
247 
249 
253  vtkSetMacro(UseDefaultNormal, vtkTypeBool);
254  vtkGetMacro(UseDefaultNormal, vtkTypeBool);
255  vtkBooleanMacro(UseDefaultNormal, vtkTypeBool);
257 
259 
264  vtkSetMacro(SidesShareVertices, vtkTypeBool);
265  vtkGetMacro(SidesShareVertices, vtkTypeBool);
266  vtkBooleanMacro(SidesShareVertices, vtkTypeBool);
268 
270 
273  vtkSetMacro(Capping, vtkTypeBool);
274  vtkGetMacro(Capping, vtkTypeBool);
275  vtkBooleanMacro(Capping, vtkTypeBool);
277 
279 
284  vtkSetClampMacro(OnRatio, int, 1, VTK_INT_MAX);
285  vtkGetMacro(OnRatio, int);
287 
289 
294  vtkSetClampMacro(Offset, int, 0, VTK_INT_MAX);
295  vtkGetMacro(Offset, int);
297 
299 
305  vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
306  vtkGetMacro(GenerateTCoords, int);
307  void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
309  {
310  this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
311  }
312  void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
313  void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
316 
318 
324  vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
325  vtkGetMacro(TextureLength, double);
327 
329 
334  vtkSetMacro(OutputPointsPrecision, int);
335  vtkGetMacro(OutputPointsPrecision, int);
337 
338 protected:
340  ~vtkTubeFilter() override = default;
341 
342  // Usual data generation method
344 
345  double Radius; // minimum radius of tube
346  int VaryRadius; // controls radius variation
347  int NumberOfSides; // number of sides to create tube
348  double RadiusFactor; // maximum allowable radius
349  double DefaultNormal[3];
352  vtkTypeBool Capping; // control whether tubes are capped
353  int OnRatio; // control the generation of the sides of the tube
354  int Offset; // control the generation of the sides
355  int GenerateTCoords; // control texture coordinate generation
357  double TextureLength; // this length is mapped to [0,1) texture space
358 
359  // Helper methods
361  vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, vtkFloatArray* newNormals,
362  vtkDataArray* inScalars, double range[2], vtkDataArray* inVectors, double maxSpeed,
363  vtkDataArray* inNormals);
364  void GenerateStrips(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkIdType inCellId,
365  vtkCellData* cd, vtkCellData* outCD, vtkCellArray* newStrips);
367  vtkPoints* inPts, vtkDataArray* inScalars, vtkFloatArray* newTCoords);
369 
370  // Helper data members
371  double Theta;
372 
373 private:
374  vtkTubeFilter(const vtkTubeFilter&) = delete;
375  void operator=(const vtkTubeFilter&) = delete;
376 };
377 
378 VTK_ABI_NAMESPACE_END
379 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:285
represent and manipulate cell attribute data
Definition: vtkCellData.h:140
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:154
dynamic, self-adjusting array of float
a simple class to control print indentation
Definition: vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate point attribute data
Definition: vtkPointData.h:139
represent and manipulate 3D points
Definition: vtkPoints.h:138
Superclass for algorithms that produce only polydata as output.
filter that generates tubes around lines
void SetGenerateTCoordsToNormalizedLength()
Control whether and how texture coordinates are produced.
const char * GetGenerateTCoordsAsString()
Control whether and how texture coordinates are produced.
static vtkTubeFilter * New()
Construct object with radius 0.5, radius variation turned off, the number of sides set to 3,...
double TextureLength
void SetGenerateTCoordsToOff()
Control whether and how texture coordinates are produced.
void SetVaryRadiusToVaryRadiusByVectorNorm()
Turn on/off the variation of tube radius with scalar value.
void SetGenerateTCoordsToUseScalars()
Control whether and how texture coordinates are produced.
vtkTypeBool UseDefaultNormal
double RadiusFactor
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int OutputPointsPrecision
int GeneratePoints(vtkIdType offset, vtkIdType npts, const vtkIdType *pts, vtkPoints *inPts, vtkPoints *newPts, vtkPointData *pd, vtkPointData *outPD, vtkFloatArray *newNormals, vtkDataArray *inScalars, double range[2], vtkDataArray *inVectors, double maxSpeed, vtkDataArray *inNormals)
void SetVaryRadiusToVaryRadiusByVector()
Turn on/off the variation of tube radius with scalar value.
const char * GetVaryRadiusAsString()
Turn on/off the variation of tube radius with scalar value.
vtkTypeBool SidesShareVertices
vtkTypeBool Capping
vtkIdType ComputeOffset(vtkIdType offset, vtkIdType npts)
void SetGenerateTCoordsToUseLength()
Control whether and how texture coordinates are produced.
void SetVaryRadiusToVaryRadiusByScalar()
Turn on/off the variation of tube radius with scalar value.
~vtkTubeFilter() override=default
void SetVaryRadiusToVaryRadiusByAbsoluteScalar()
Turn on/off the variation of tube radius with scalar value.
void SetVaryRadiusToVaryRadiusOff()
Turn on/off the variation of tube radius with scalar value.
void GenerateStrips(vtkIdType offset, vtkIdType npts, const vtkIdType *pts, vtkIdType inCellId, vtkCellData *cd, vtkCellData *outCD, vtkCellArray *newStrips)
void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, const vtkIdType *pts, vtkPoints *inPts, vtkDataArray *inScalars, vtkFloatArray *newTCoords)
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
@ range
Definition: vtkX3D.h:238
@ offset
Definition: vtkX3D.h:438
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_TCOORDS_FROM_SCALARS
#define VTK_VARY_RADIUS_BY_SCALAR
#define VTK_TCOORDS_FROM_LENGTH
#define VTK_VARY_RADIUS_BY_VECTOR_NORM
#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH
#define VTK_VARY_RADIUS_OFF
#define VTK_VARY_RADIUS_BY_VECTOR
#define VTK_TCOORDS_OFF
#define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR
int vtkIdType
Definition: vtkType.h:315
#define VTK_DOUBLE_MAX
Definition: vtkType.h:154
#define VTK_INT_MAX
Definition: vtkType.h:144