VTK  9.5.20250920
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#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
164
165#define VTK_VARY_RADIUS_OFF 0
166#define VTK_VARY_RADIUS_BY_SCALAR 1
167#define VTK_VARY_RADIUS_BY_VECTOR 2
168#define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR 3
169#define VTK_VARY_RADIUS_BY_VECTOR_NORM 4
170
171#define VTK_TCOORDS_OFF 0
172#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
173#define VTK_TCOORDS_FROM_LENGTH 2
174#define VTK_TCOORDS_FROM_SCALARS 3
175
176VTK_ABI_NAMESPACE_BEGIN
177class vtkCellArray;
178class vtkCellData;
179class vtkDataArray;
180class vtkFloatArray;
181class vtkPointData;
182class vtkPoints;
183
184class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkTubeFilter : public vtkPolyDataAlgorithm
185{
186public:
188 void PrintSelf(ostream& os, vtkIndent indent) override;
189
195
197
200 vtkSetClampMacro(Radius, double, 0.0, VTK_DOUBLE_MAX);
201 vtkGetMacro(Radius, double);
203
205
208 vtkSetClampMacro(VaryRadius, int, VTK_VARY_RADIUS_OFF, VTK_VARY_RADIUS_BY_VECTOR_NORM);
209 vtkGetMacro(VaryRadius, int);
210 void SetVaryRadiusToVaryRadiusOff() { this->SetVaryRadius(VTK_VARY_RADIUS_OFF); }
214 {
215 this->SetVaryRadius(VTK_VARY_RADIUS_BY_VECTOR_NORM);
216 }
218 {
219 this->SetVaryRadius(VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR);
220 }
223
225
228 vtkSetClampMacro(NumberOfSides, int, 3, VTK_INT_MAX);
229 vtkGetMacro(NumberOfSides, int);
231
233
236 vtkSetMacro(RadiusFactor, double);
237 vtkGetMacro(RadiusFactor, double);
239
241
245 vtkSetVector3Macro(DefaultNormal, double);
246 vtkGetVectorMacro(DefaultNormal, double, 3);
248
250
254 vtkSetMacro(UseDefaultNormal, vtkTypeBool);
255 vtkGetMacro(UseDefaultNormal, vtkTypeBool);
256 vtkBooleanMacro(UseDefaultNormal, vtkTypeBool);
258
260
265 vtkSetMacro(SidesShareVertices, vtkTypeBool);
266 vtkGetMacro(SidesShareVertices, vtkTypeBool);
267 vtkBooleanMacro(SidesShareVertices, vtkTypeBool);
269
271
274 vtkSetMacro(Capping, vtkTypeBool);
275 vtkGetMacro(Capping, vtkTypeBool);
276 vtkBooleanMacro(Capping, vtkTypeBool);
278
280
285 vtkSetClampMacro(OnRatio, int, 1, VTK_INT_MAX);
286 vtkGetMacro(OnRatio, int);
288
290
295 vtkSetClampMacro(Offset, int, 0, VTK_INT_MAX);
296 vtkGetMacro(Offset, int);
298
300
306 vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
307 vtkGetMacro(GenerateTCoords, int);
308 void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
310 {
311 this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
312 }
313 void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
314 void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
317
319
325 vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
326 vtkGetMacro(TextureLength, double);
328
330
335 vtkSetMacro(OutputPointsPrecision, int);
336 vtkGetMacro(OutputPointsPrecision, int);
338
339protected:
341 ~vtkTubeFilter() override = default;
342
343 // Usual data generation method
345
346 double Radius; // minimum radius of tube
347 int VaryRadius; // controls radius variation
348 int NumberOfSides; // number of sides to create tube
349 double RadiusFactor; // maximum allowable radius
350 double DefaultNormal[3];
353 vtkTypeBool Capping; // control whether tubes are capped
354 int OnRatio; // control the generation of the sides of the tube
355 int Offset; // control the generation of the sides
356 int GenerateTCoords; // control texture coordinate generation
358 double TextureLength; // this length is mapped to [0,1) texture space
359
360 // Helper methods
361 int GeneratePoints(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkPoints* inPts,
362 vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, vtkFloatArray* newNormals,
363 vtkDataArray* inScalars, double range[2], vtkDataArray* inVectors, double maxSpeed,
364 vtkDataArray* inNormals);
365 void GenerateStrips(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkIdType inCellId,
366 vtkCellData* cd, vtkCellData* outCD, vtkCellArray* newStrips);
367 void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, const vtkIdType* pts,
368 vtkPoints* inPts, vtkDataArray* inScalars, vtkFloatArray* newTCoords);
370
371 // Helper data members
372 double Theta;
373
374private:
375 vtkTubeFilter(const vtkTubeFilter&) = delete;
376 void operator=(const vtkTubeFilter&) = delete;
377};
378
379VTK_ABI_NAMESPACE_END
380#endif
object to represent cell connectivity
represent and manipulate cell attribute data
abstract superclass for arrays of numeric data
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
represent and manipulate 3D points
Definition vtkPoints.h:139
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.
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
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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.
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:333
#define VTK_DOUBLE_MAX
Definition vtkType.h:172
#define VTK_INT_MAX
Definition vtkType.h:162
#define VTK_MARSHALAUTO