VTK  9.2.6
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=========================================================================*/
170#ifndef vtkTubeFilter_h
171#define vtkTubeFilter_h
172
173#include "vtkFiltersCoreModule.h" // For export macro
174#include "vtkPolyDataAlgorithm.h"
175
176#define VTK_VARY_RADIUS_OFF 0
177#define VTK_VARY_RADIUS_BY_SCALAR 1
178#define VTK_VARY_RADIUS_BY_VECTOR 2
179#define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR 3
180#define VTK_VARY_RADIUS_BY_VECTOR_NORM 4
181
182#define VTK_TCOORDS_OFF 0
183#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
184#define VTK_TCOORDS_FROM_LENGTH 2
185#define VTK_TCOORDS_FROM_SCALARS 3
186
187class vtkCellArray;
188class vtkCellData;
189class vtkDataArray;
190class vtkFloatArray;
191class vtkPointData;
192class vtkPoints;
193
194class VTKFILTERSCORE_EXPORT vtkTubeFilter : public vtkPolyDataAlgorithm
195{
196public:
198 void PrintSelf(ostream& os, vtkIndent indent) override;
199
205
207
210 vtkSetClampMacro(Radius, double, 0.0, VTK_DOUBLE_MAX);
211 vtkGetMacro(Radius, double);
213
215
218 vtkSetClampMacro(VaryRadius, int, VTK_VARY_RADIUS_OFF, VTK_VARY_RADIUS_BY_VECTOR_NORM);
219 vtkGetMacro(VaryRadius, int);
220 void SetVaryRadiusToVaryRadiusOff() { this->SetVaryRadius(VTK_VARY_RADIUS_OFF); }
224 {
225 this->SetVaryRadius(VTK_VARY_RADIUS_BY_VECTOR_NORM);
226 }
228 {
229 this->SetVaryRadius(VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR);
230 }
233
235
238 vtkSetClampMacro(NumberOfSides, int, 3, VTK_INT_MAX);
239 vtkGetMacro(NumberOfSides, int);
241
243
246 vtkSetMacro(RadiusFactor, double);
247 vtkGetMacro(RadiusFactor, double);
249
251
255 vtkSetVector3Macro(DefaultNormal, double);
256 vtkGetVectorMacro(DefaultNormal, double, 3);
258
260
264 vtkSetMacro(UseDefaultNormal, vtkTypeBool);
265 vtkGetMacro(UseDefaultNormal, vtkTypeBool);
266 vtkBooleanMacro(UseDefaultNormal, vtkTypeBool);
268
270
275 vtkSetMacro(SidesShareVertices, vtkTypeBool);
276 vtkGetMacro(SidesShareVertices, vtkTypeBool);
277 vtkBooleanMacro(SidesShareVertices, vtkTypeBool);
279
281
284 vtkSetMacro(Capping, vtkTypeBool);
285 vtkGetMacro(Capping, vtkTypeBool);
286 vtkBooleanMacro(Capping, vtkTypeBool);
288
290
295 vtkSetClampMacro(OnRatio, int, 1, VTK_INT_MAX);
296 vtkGetMacro(OnRatio, int);
298
300
305 vtkSetClampMacro(Offset, int, 0, VTK_INT_MAX);
306 vtkGetMacro(Offset, int);
308
310
316 vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
317 vtkGetMacro(GenerateTCoords, int);
318 void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
320 {
321 this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
322 }
323 void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
324 void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
327
329
335 vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
336 vtkGetMacro(TextureLength, double);
338
340
345 vtkSetMacro(OutputPointsPrecision, int);
346 vtkGetMacro(OutputPointsPrecision, int);
348
349protected:
351 ~vtkTubeFilter() override = default;
352
353 // Usual data generation method
355
356 double Radius; // minimum radius of tube
357 int VaryRadius; // controls radius variation
358 int NumberOfSides; // number of sides to create tube
359 double RadiusFactor; // maximum allowable radius
360 double DefaultNormal[3];
363 vtkTypeBool Capping; // control whether tubes are capped
364 int OnRatio; // control the generation of the sides of the tube
365 int Offset; // control the generation of the sides
366 int GenerateTCoords; // control texture coordinate generation
368 double TextureLength; // this length is mapped to [0,1) texture space
369
370 // Helper methods
372 vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, vtkFloatArray* newNormals,
373 vtkDataArray* inScalars, double range[2], vtkDataArray* inVectors, double maxSpeed,
374 vtkDataArray* inNormals);
375 void GenerateStrips(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkIdType inCellId,
376 vtkCellData* cd, vtkCellData* outCD, vtkCellArray* newStrips);
378 vtkPoints* inPts, vtkDataArray* inScalars, vtkFloatArray* newTCoords);
380
381 // Helper data members
382 double Theta;
383
384private:
385 vtkTubeFilter(const vtkTubeFilter&) = delete;
386 void operator=(const vtkTubeFilter&) = delete;
387};
388
389#endif
object to represent cell connectivity
Definition: vtkCellArray.h:296
represent and manipulate cell attribute data
Definition: vtkCellData.h:151
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:165
dynamic, self-adjusting array of float
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate point attribute data
Definition: vtkPointData.h:151
represent and manipulate 3D points
Definition: vtkPoints.h:149
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