VTK  9.3.20240328
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
66 #ifndef vtkRibbonFilter_h
67 #define vtkRibbonFilter_h
68 
69 #include "vtkFiltersModelingModule.h" // For export macro
70 #include "vtkPolyDataAlgorithm.h"
71 
72 #define VTK_TCOORDS_OFF 0
73 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
74 #define VTK_TCOORDS_FROM_LENGTH 2
75 #define VTK_TCOORDS_FROM_SCALARS 3
76 
77 VTK_ABI_NAMESPACE_BEGIN
78 class vtkCellArray;
79 class vtkCellData;
80 class vtkDataArray;
81 class vtkFloatArray;
82 class vtkPointData;
83 class vtkPoints;
84 
85 class VTKFILTERSMODELING_EXPORT vtkRibbonFilter : public vtkPolyDataAlgorithm
86 {
87 public:
89  void PrintSelf(ostream& os, vtkIndent indent) override;
90 
95  static vtkRibbonFilter* New();
96 
98 
102  vtkSetClampMacro(Width, double, 0, VTK_DOUBLE_MAX);
103  vtkGetMacro(Width, double);
105 
107 
111  vtkSetClampMacro(Angle, double, 0, 360);
112  vtkGetMacro(Angle, double);
114 
116 
120  vtkSetMacro(VaryWidth, vtkTypeBool);
121  vtkGetMacro(VaryWidth, vtkTypeBool);
122  vtkBooleanMacro(VaryWidth, vtkTypeBool);
124 
126 
130  vtkSetMacro(WidthFactor, double);
131  vtkGetMacro(WidthFactor, double);
133 
135 
139  vtkSetVector3Macro(DefaultNormal, double);
140  vtkGetVectorMacro(DefaultNormal, double, 3);
142 
144 
148  vtkSetMacro(UseDefaultNormal, vtkTypeBool);
149  vtkGetMacro(UseDefaultNormal, vtkTypeBool);
150  vtkBooleanMacro(UseDefaultNormal, vtkTypeBool);
152 
154 
158  vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
159  vtkGetMacro(GenerateTCoords, int);
160  void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
162  {
163  this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
164  }
165  void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
166  void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
169 
171 
177  vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
178  vtkGetMacro(TextureLength, double);
180 
181 protected:
183  ~vtkRibbonFilter() override;
184 
186  double Width;
187  double Angle;
188  vtkTypeBool VaryWidth; // controls whether width varies with scalar data
189  double WidthFactor;
190  double DefaultNormal[3];
192  int GenerateTCoords; // control texture coordinate generation
193  double TextureLength; // this length is mapped to [0,1) texture space
194 
195  // Helper methods
197  vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, vtkFloatArray* newNormals,
198  vtkDataArray* inScalars, double range[2], vtkDataArray* inNormals);
199  void GenerateStrip(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkIdType inCellId,
200  vtkCellData* cd, vtkCellData* outCD, vtkCellArray* newStrips);
202  vtkPoints* inPts, vtkDataArray* inScalars, vtkFloatArray* newTCoords);
204 
205  // Helper data members
206  double Theta;
207 
208 private:
209  vtkRibbonFilter(const vtkRibbonFilter&) = delete;
210  void operator=(const vtkRibbonFilter&) = delete;
211 };
212 
213 VTK_ABI_NAMESPACE_END
214 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:285
represent and manipulate cell attribute data
Definition: vtkCellData.h:140
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:154
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
Definition: vtkPointData.h:139
represent and manipulate 3D points
Definition: vtkPoints.h:138
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