VTK  9.3.1
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); }
128  const char* GetGenerateTCoordsAsString();
130 
132 
138  vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
139  vtkGetMacro(TextureLength, double);
141 
142 protected:
143  vtkRibbonFilter();
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
157  int GeneratePoints(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkPoints* inPts,
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);
162  void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, const vtkIdType* pts,
163  vtkPoints* inPts, vtkDataArray* inScalars, vtkFloatArray* newTCoords);
164  vtkIdType ComputeOffset(vtkIdType offset, vtkIdType npts);
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
#define VTK_TCOORDS_OFF
void SetGenerateTCoordsToOff()
Control whether and how texture coordinates are produced.
#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH
represent and manipulate point attribute data
Definition: vtkPointData.h:29
vtkTypeBool UseDefaultNormal
create oriented ribbons from lines defined in polygonal dataset
#define VTK_DOUBLE_MAX
Definition: vtkType.h:154
Store vtkAlgorithm input/output information.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
#define VTK_INT_MAX
Definition: vtkType.h:144
represent and manipulate cell attribute data
Definition: vtkCellData.h:30
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:30
int vtkIdType
Definition: vtkType.h:315
void SetGenerateTCoordsToUseLength()
Control whether and how texture coordinates are produced.
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:64
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:28
void SetGenerateTCoordsToUseScalars()
Control whether and how texture coordinates are produced.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
vtkTypeBool VaryWidth
object to represent cell connectivity
Definition: vtkCellArray.h:175
void SetGenerateTCoordsToNormalizedLength()
Control whether and how texture coordinates are produced.
#define VTK_TCOORDS_FROM_LENGTH
#define VTK_TCOORDS_FROM_SCALARS
Store zero or more vtkInformation instances.
represent and manipulate 3D points
Definition: vtkPoints.h:28
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.