VTK  9.1.0
vtkRibbonFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkRibbonFilter.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
75 #ifndef vtkRibbonFilter_h
76 #define vtkRibbonFilter_h
77 
78 #include "vtkFiltersModelingModule.h" // For export macro
79 #include "vtkPolyDataAlgorithm.h"
80 
81 #define VTK_TCOORDS_OFF 0
82 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
83 #define VTK_TCOORDS_FROM_LENGTH 2
84 #define VTK_TCOORDS_FROM_SCALARS 3
85 
86 class vtkCellArray;
87 class vtkCellData;
88 class vtkDataArray;
89 class vtkFloatArray;
90 class vtkPointData;
91 class vtkPoints;
92 
93 class VTKFILTERSMODELING_EXPORT vtkRibbonFilter : public vtkPolyDataAlgorithm
94 {
95 public:
97  void PrintSelf(ostream& os, vtkIndent indent) override;
98 
103  static vtkRibbonFilter* New();
104 
106 
110  vtkSetClampMacro(Width, double, 0, VTK_DOUBLE_MAX);
111  vtkGetMacro(Width, double);
113 
115 
119  vtkSetClampMacro(Angle, double, 0, 360);
120  vtkGetMacro(Angle, double);
122 
124 
128  vtkSetMacro(VaryWidth, vtkTypeBool);
129  vtkGetMacro(VaryWidth, vtkTypeBool);
130  vtkBooleanMacro(VaryWidth, vtkTypeBool);
132 
134 
138  vtkSetMacro(WidthFactor, double);
139  vtkGetMacro(WidthFactor, double);
141 
143 
147  vtkSetVector3Macro(DefaultNormal, double);
148  vtkGetVectorMacro(DefaultNormal, double, 3);
150 
152 
156  vtkSetMacro(UseDefaultNormal, vtkTypeBool);
157  vtkGetMacro(UseDefaultNormal, vtkTypeBool);
158  vtkBooleanMacro(UseDefaultNormal, vtkTypeBool);
160 
162 
166  vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
167  vtkGetMacro(GenerateTCoords, int);
168  void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
170  {
171  this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
172  }
173  void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
174  void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
177 
179 
185  vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
186  vtkGetMacro(TextureLength, double);
188 
189 protected:
191  ~vtkRibbonFilter() override;
192 
194  double Width;
195  double Angle;
196  vtkTypeBool VaryWidth; // controls whether width varies with scalar data
197  double WidthFactor;
198  double DefaultNormal[3];
200  int GenerateTCoords; // control texture coordinate generation
201  double TextureLength; // this length is mapped to [0,1) texture space
202 
203  // Helper methods
205  vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, vtkFloatArray* newNormals,
206  vtkDataArray* inScalars, double range[2], vtkDataArray* inNormals);
207  void GenerateStrip(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkIdType inCellId,
208  vtkCellData* cd, vtkCellData* outCD, vtkCellArray* newStrips);
210  vtkPoints* inPts, vtkDataArray* inScalars, vtkFloatArray* newTCoords);
212 
213  // Helper data members
214  double Theta;
215 
216 private:
217  vtkRibbonFilter(const vtkRibbonFilter&) = delete;
218  void operator=(const vtkRibbonFilter&) = delete;
219 };
220 
221 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:290
represent and manipulate cell attribute data
Definition: vtkCellData.h:142
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
dynamic, self-adjusting array of float
a simple class to control print indentation
Definition: vtkIndent.h:113
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate point attribute data
Definition: vtkPointData.h:142
represent and manipulate 3D points
Definition: vtkPoints.h:143
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:244
@ offset
Definition: vtkX3D.h:444
int vtkTypeBool
Definition: vtkABI.h:69
#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:332
#define VTK_DOUBLE_MAX
Definition: vtkType.h:165
#define VTK_INT_MAX
Definition: vtkType.h:155