VTK  9.3.20240423
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
175VTK_ABI_NAMESPACE_BEGIN
176class vtkCellArray;
177class vtkCellData;
178class vtkDataArray;
179class vtkFloatArray;
180class vtkPointData;
181class vtkPoints;
182
183class VTKFILTERSCORE_EXPORT vtkTubeFilter : public vtkPolyDataAlgorithm
184{
185public:
187 void PrintSelf(ostream& os, vtkIndent indent) override;
188
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 }
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
338protected:
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
360 int GeneratePoints(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkPoints* inPts,
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);
366 void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, const vtkIdType* pts,
367 vtkPoints* inPts, vtkDataArray* inScalars, vtkFloatArray* newTCoords);
369
370 // Helper data members
371 double Theta;
372
373private:
374 vtkTubeFilter(const vtkTubeFilter&) = delete;
375 void operator=(const vtkTubeFilter&) = delete;
376};
377
378VTK_ABI_NAMESPACE_END
379#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:315
#define VTK_DOUBLE_MAX
Definition vtkType.h:154
#define VTK_INT_MAX
Definition vtkType.h:144