VTK  9.3.0
vtkRibbonFilter.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
27 #ifndef vtkRibbonFilter_h
28 #define vtkRibbonFilter_h
29 
30 #include "vtkFiltersModelingModule.h" // For export macro
31 #include "vtkPolyDataAlgorithm.h"
32 
33 #define VTK_TCOORDS_OFF 0
34 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
35 #define VTK_TCOORDS_FROM_LENGTH 2
36 #define VTK_TCOORDS_FROM_SCALARS 3
37 
38 VTK_ABI_NAMESPACE_BEGIN
39 class vtkCellArray;
40 class vtkCellData;
41 class vtkDataArray;
42 class vtkFloatArray;
43 class vtkPointData;
44 class vtkPoints;
45 
46 class VTKFILTERSMODELING_EXPORT vtkRibbonFilter : public vtkPolyDataAlgorithm
47 {
48 public:
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
56  static vtkRibbonFilter* New();
57 
59 
63  vtkSetClampMacro(Width, double, 0, VTK_DOUBLE_MAX);
64  vtkGetMacro(Width, double);
66 
68 
72  vtkSetClampMacro(Angle, double, 0, 360);
73  vtkGetMacro(Angle, double);
75 
77 
81  vtkSetMacro(VaryWidth, vtkTypeBool);
82  vtkGetMacro(VaryWidth, vtkTypeBool);
83  vtkBooleanMacro(VaryWidth, vtkTypeBool);
85 
87 
91  vtkSetMacro(WidthFactor, double);
92  vtkGetMacro(WidthFactor, double);
94 
96 
100  vtkSetVector3Macro(DefaultNormal, double);
101  vtkGetVectorMacro(DefaultNormal, double, 3);
103 
105 
109  vtkSetMacro(UseDefaultNormal, vtkTypeBool);
110  vtkGetMacro(UseDefaultNormal, vtkTypeBool);
111  vtkBooleanMacro(UseDefaultNormal, vtkTypeBool);
113 
115 
119  vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
120  vtkGetMacro(GenerateTCoords, int);
121  void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
123  {
124  this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
125  }
126  void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
127  void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
130 
132 
138  vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
139  vtkGetMacro(TextureLength, double);
141 
142 protected:
144  ~vtkRibbonFilter() override;
145 
147  double Width;
148  double Angle;
149  vtkTypeBool VaryWidth; // controls whether width varies with scalar data
150  double WidthFactor;
151  double DefaultNormal[3];
153  int GenerateTCoords; // control texture coordinate generation
154  double TextureLength; // this length is mapped to [0,1) texture space
155 
156  // Helper methods
158  vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, vtkFloatArray* newNormals,
159  vtkDataArray* inScalars, double range[2], vtkDataArray* inNormals);
160  void GenerateStrip(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkIdType inCellId,
161  vtkCellData* cd, vtkCellData* outCD, vtkCellArray* newStrips);
163  vtkPoints* inPts, vtkDataArray* inScalars, vtkFloatArray* newTCoords);
165 
166  // Helper data members
167  double Theta;
168 
169 private:
170  vtkRibbonFilter(const vtkRibbonFilter&) = delete;
171  void operator=(const vtkRibbonFilter&) = delete;
172 };
173 
174 VTK_ABI_NAMESPACE_END
175 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:176
represent and manipulate cell attribute data
Definition: vtkCellData.h:31
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:45
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:31
a simple class to control print indentation
Definition: vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate point attribute data
Definition: vtkPointData.h:30
represent and manipulate 3D points
Definition: vtkPoints.h:29
Superclass for algorithms that produce only polydata as output.
create oriented ribbons from lines defined in polygonal dataset
void SetGenerateTCoordsToUseLength()
Control whether and how texture coordinates are produced.
void SetGenerateTCoordsToUseScalars()
Control whether and how texture coordinates are produced.
void SetGenerateTCoordsToNormalizedLength()
Control whether and how texture coordinates are produced.
const char * GetGenerateTCoordsAsString()
Control whether and how texture coordinates are produced.
vtkIdType ComputeOffset(vtkIdType offset, vtkIdType npts)
vtkTypeBool UseDefaultNormal
void SetGenerateTCoordsToOff()
Control whether and how texture coordinates are produced.
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 *inNormals)
vtkTypeBool VaryWidth
~vtkRibbonFilter() override
static vtkRibbonFilter * New()
Construct ribbon so that width is 0.1, the width does not vary with scalar values,...
void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, const vtkIdType *pts, vtkPoints *inPts, vtkDataArray *inScalars, vtkFloatArray *newTCoords)
void GenerateStrip(vtkIdType offset, vtkIdType npts, const vtkIdType *pts, vtkIdType inCellId, vtkCellData *cd, vtkCellData *outCD, vtkCellArray *newStrips)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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_TCOORDS_FROM_LENGTH
#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH
#define VTK_TCOORDS_OFF
int vtkIdType
Definition: vtkType.h:315
#define VTK_DOUBLE_MAX
Definition: vtkType.h:154
#define VTK_INT_MAX
Definition: vtkType.h:144