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
36 #ifndef vtkRibbonFilter_h
37 #define vtkRibbonFilter_h
38 
39 #include "vtkFiltersModelingModule.h" // For export macro
40 #include "vtkPolyDataAlgorithm.h"
41 
42 #define VTK_TCOORDS_OFF 0
43 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
44 #define VTK_TCOORDS_FROM_LENGTH 2
45 #define VTK_TCOORDS_FROM_SCALARS 3
46 
47 VTK_ABI_NAMESPACE_BEGIN
48 class vtkCellArray;
49 class vtkCellData;
50 class vtkDataArray;
51 class vtkFloatArray;
52 class vtkPointData;
53 class vtkPoints;
54 
55 class VTKFILTERSMODELING_EXPORT vtkRibbonFilter : public vtkPolyDataAlgorithm
56 {
57 public:
59  void PrintSelf(ostream& os, vtkIndent indent) override;
60 
65  static vtkRibbonFilter* New();
66 
68 
72  vtkSetClampMacro(Width, double, 0, VTK_DOUBLE_MAX);
73  vtkGetMacro(Width, double);
75 
77 
81  vtkSetClampMacro(Angle, double, 0, 360);
82  vtkGetMacro(Angle, double);
84 
86 
90  vtkSetMacro(VaryWidth, vtkTypeBool);
91  vtkGetMacro(VaryWidth, vtkTypeBool);
92  vtkBooleanMacro(VaryWidth, vtkTypeBool);
94 
96 
100  vtkSetMacro(WidthFactor, double);
101  vtkGetMacro(WidthFactor, double);
103 
105 
109  vtkSetVector3Macro(DefaultNormal, double);
110  vtkGetVectorMacro(DefaultNormal, double, 3);
112 
114 
118  vtkSetMacro(UseDefaultNormal, vtkTypeBool);
119  vtkGetMacro(UseDefaultNormal, vtkTypeBool);
120  vtkBooleanMacro(UseDefaultNormal, vtkTypeBool);
122 
124 
128  vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
129  vtkGetMacro(GenerateTCoords, int);
130  void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
132  {
133  this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
134  }
135  void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
136  void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
139 
141 
147  vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
148  vtkGetMacro(TextureLength, double);
150 
151 protected:
153  ~vtkRibbonFilter() override;
154 
156  double Width;
157  double Angle;
158  vtkTypeBool VaryWidth; // controls whether width varies with scalar data
159  double WidthFactor;
160  double DefaultNormal[3];
162  int GenerateTCoords; // control texture coordinate generation
163  double TextureLength; // this length is mapped to [0,1) texture space
164 
165  // Helper methods
167  vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, vtkFloatArray* newNormals,
168  vtkDataArray* inScalars, double range[2], vtkDataArray* inNormals);
169  void GenerateStrip(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkIdType inCellId,
170  vtkCellData* cd, vtkCellData* outCD, vtkCellArray* newStrips);
172  vtkPoints* inPts, vtkDataArray* inScalars, vtkFloatArray* newTCoords);
174 
175  // Helper data members
176  double Theta;
177 
178 private:
179  vtkRibbonFilter(const vtkRibbonFilter&) = delete;
180  void operator=(const vtkRibbonFilter&) = delete;
181 };
182 
183 VTK_ABI_NAMESPACE_END
184 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:185
represent and manipulate cell attribute data
Definition: vtkCellData.h:40
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:40
a simple class to control print indentation
Definition: vtkIndent.h:38
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate point attribute data
Definition: vtkPointData.h:39
represent and manipulate 3D points
Definition: vtkPoints.h:38
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