VTK  9.1.0
vtkTubeFilter.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkTubeFilter.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=========================================================================*/
164#ifndef vtkTubeFilter_h
165#define vtkTubeFilter_h
166
167#include "vtkFiltersCoreModule.h" // For export macro
168#include "vtkPolyDataAlgorithm.h"
169
170#define VTK_VARY_RADIUS_OFF 0
171#define VTK_VARY_RADIUS_BY_SCALAR 1
172#define VTK_VARY_RADIUS_BY_VECTOR 2
173#define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR 3
174#define VTK_VARY_RADIUS_BY_VECTOR_NORM 4
175
176#define VTK_TCOORDS_OFF 0
177#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
178#define VTK_TCOORDS_FROM_LENGTH 2
179#define VTK_TCOORDS_FROM_SCALARS 3
180
181class vtkCellArray;
182class vtkCellData;
183class vtkDataArray;
184class vtkFloatArray;
185class vtkPointData;
186class vtkPoints;
187
188class VTKFILTERSCORE_EXPORT vtkTubeFilter : public vtkPolyDataAlgorithm
189{
190public:
192 void PrintSelf(ostream& os, vtkIndent indent) override;
193
199
201
204 vtkSetClampMacro(Radius, double, 0.0, VTK_DOUBLE_MAX);
205 vtkGetMacro(Radius, double);
207
209
212 vtkSetClampMacro(VaryRadius, int, VTK_VARY_RADIUS_OFF, VTK_VARY_RADIUS_BY_VECTOR_NORM);
213 vtkGetMacro(VaryRadius, int);
214 void SetVaryRadiusToVaryRadiusOff() { this->SetVaryRadius(VTK_VARY_RADIUS_OFF); }
218 {
219 this->SetVaryRadius(VTK_VARY_RADIUS_BY_VECTOR_NORM);
220 }
222 {
223 this->SetVaryRadius(VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR);
224 }
227
229
232 vtkSetClampMacro(NumberOfSides, int, 3, VTK_INT_MAX);
233 vtkGetMacro(NumberOfSides, int);
235
237
240 vtkSetMacro(RadiusFactor, double);
241 vtkGetMacro(RadiusFactor, double);
243
245
249 vtkSetVector3Macro(DefaultNormal, double);
250 vtkGetVectorMacro(DefaultNormal, double, 3);
252
254
258 vtkSetMacro(UseDefaultNormal, vtkTypeBool);
259 vtkGetMacro(UseDefaultNormal, vtkTypeBool);
260 vtkBooleanMacro(UseDefaultNormal, vtkTypeBool);
262
264
269 vtkSetMacro(SidesShareVertices, vtkTypeBool);
270 vtkGetMacro(SidesShareVertices, vtkTypeBool);
271 vtkBooleanMacro(SidesShareVertices, vtkTypeBool);
273
275
278 vtkSetMacro(Capping, vtkTypeBool);
279 vtkGetMacro(Capping, vtkTypeBool);
280 vtkBooleanMacro(Capping, vtkTypeBool);
282
284
289 vtkSetClampMacro(OnRatio, int, 1, VTK_INT_MAX);
290 vtkGetMacro(OnRatio, int);
292
294
299 vtkSetClampMacro(Offset, int, 0, VTK_INT_MAX);
300 vtkGetMacro(Offset, int);
302
304
310 vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
311 vtkGetMacro(GenerateTCoords, int);
312 void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
314 {
315 this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
316 }
317 void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
318 void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
321
323
329 vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
330 vtkGetMacro(TextureLength, double);
332
334
339 vtkSetMacro(OutputPointsPrecision, int);
340 vtkGetMacro(OutputPointsPrecision, int);
342
343protected:
345 ~vtkTubeFilter() override = default;
346
347 // Usual data generation method
349
350 double Radius; // minimum radius of tube
351 int VaryRadius; // controls radius variation
352 int NumberOfSides; // number of sides to create tube
353 double RadiusFactor; // maximum allowable radius
354 double DefaultNormal[3];
357 vtkTypeBool Capping; // control whether tubes are capped
358 int OnRatio; // control the generation of the sides of the tube
359 int Offset; // control the generation of the sides
360 int GenerateTCoords; // control texture coordinate generation
362 double TextureLength; // this length is mapped to [0,1) texture space
363
364 // Helper methods
366 vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, vtkFloatArray* newNormals,
367 vtkDataArray* inScalars, double range[2], vtkDataArray* inVectors, double maxSpeed,
368 vtkDataArray* inNormals);
369 void GenerateStrips(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkIdType inCellId,
370 vtkCellData* cd, vtkCellData* outCD, vtkCellArray* newStrips);
372 vtkPoints* inPts, vtkDataArray* inScalars, vtkFloatArray* newTCoords);
374
375 // Helper data members
376 double Theta;
377
378private:
379 vtkTubeFilter(const vtkTubeFilter&) = delete;
380 void operator=(const vtkTubeFilter&) = delete;
381};
382
383#endif
object to represent cell connectivity
Definition: vtkCellArray.h:290
represent and manipulate cell attribute data
Definition: vtkCellData.h:142
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
dynamic, self-adjusting array of float
a simple class to control print indentation
Definition: vtkIndent.h:113
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate point attribute data
Definition: vtkPointData.h:142
represent and manipulate 3D points
Definition: vtkPoints.h:143
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.
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.
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.
static vtkTubeFilter * New()
Construct object with radius 0.5, radius variation turned off, the number of sides set to 3,...
~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.
const char * GetGenerateTCoordsAsString()
Control whether and how texture coordinates are produced.
const char * GetVaryRadiusAsString()
Turn on/off the variation of tube radius with scalar value.
@ range
Definition: vtkX3D.h:244
@ offset
Definition: vtkX3D.h:444
int vtkTypeBool
Definition: vtkABI.h:69
#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:332
#define VTK_DOUBLE_MAX
Definition: vtkType.h:165
#define VTK_INT_MAX
Definition: vtkType.h:155