VTK  9.2.6
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 =========================================================================*/
39 #ifndef vtkRibbonFilter_h
40 #define vtkRibbonFilter_h
41 
42 #include "vtkFiltersModelingModule.h" // For export macro
43 #include "vtkPolyDataAlgorithm.h"
44 
45 #define VTK_TCOORDS_OFF 0
46 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
47 #define VTK_TCOORDS_FROM_LENGTH 2
48 #define VTK_TCOORDS_FROM_SCALARS 3
49 
50 class vtkCellArray;
51 class vtkCellData;
52 class vtkDataArray;
53 class vtkFloatArray;
54 class vtkPointData;
55 class vtkPoints;
56 
57 class VTKFILTERSMODELING_EXPORT vtkRibbonFilter : public vtkPolyDataAlgorithm
58 {
59 public:
61  void PrintSelf(ostream& os, vtkIndent indent) override;
62 
67  static vtkRibbonFilter* New();
68 
70 
74  vtkSetClampMacro(Width, double, 0, VTK_DOUBLE_MAX);
75  vtkGetMacro(Width, double);
77 
79 
83  vtkSetClampMacro(Angle, double, 0, 360);
84  vtkGetMacro(Angle, double);
86 
88 
92  vtkSetMacro(VaryWidth, vtkTypeBool);
93  vtkGetMacro(VaryWidth, vtkTypeBool);
94  vtkBooleanMacro(VaryWidth, vtkTypeBool);
96 
98 
102  vtkSetMacro(WidthFactor, double);
103  vtkGetMacro(WidthFactor, double);
105 
107 
111  vtkSetVector3Macro(DefaultNormal, double);
112  vtkGetVectorMacro(DefaultNormal, double, 3);
114 
116 
120  vtkSetMacro(UseDefaultNormal, vtkTypeBool);
121  vtkGetMacro(UseDefaultNormal, vtkTypeBool);
122  vtkBooleanMacro(UseDefaultNormal, vtkTypeBool);
124 
126 
130  vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
131  vtkGetMacro(GenerateTCoords, int);
132  void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
134  {
135  this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
136  }
137  void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
138  void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
139  const char* GetGenerateTCoordsAsString();
141 
143 
149  vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
150  vtkGetMacro(TextureLength, double);
152 
153 protected:
154  vtkRibbonFilter();
155  ~vtkRibbonFilter() override;
156 
158  double Width;
159  double Angle;
160  vtkTypeBool VaryWidth; // controls whether width varies with scalar data
161  double WidthFactor;
162  double DefaultNormal[3];
164  int GenerateTCoords; // control texture coordinate generation
165  double TextureLength; // this length is mapped to [0,1) texture space
166 
167  // Helper methods
168  int GeneratePoints(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkPoints* inPts,
169  vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, vtkFloatArray* newNormals,
170  vtkDataArray* inScalars, double range[2], vtkDataArray* inNormals);
171  void GenerateStrip(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkIdType inCellId,
172  vtkCellData* cd, vtkCellData* outCD, vtkCellArray* newStrips);
173  void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, const vtkIdType* pts,
174  vtkPoints* inPts, vtkDataArray* inScalars, vtkFloatArray* newTCoords);
175  vtkIdType ComputeOffset(vtkIdType offset, vtkIdType npts);
176 
177  // Helper data members
178  double Theta;
179 
180 private:
181  vtkRibbonFilter(const vtkRibbonFilter&) = delete;
182  void operator=(const vtkRibbonFilter&) = delete;
183 };
184 
185 #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:41
vtkTypeBool UseDefaultNormal
create oriented ribbons from lines defined in polygonal dataset
#define VTK_DOUBLE_MAX
Definition: vtkType.h:165
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:155
represent and manipulate cell attribute data
Definition: vtkCellData.h:41
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:41
int vtkIdType
Definition: vtkType.h:332
void SetGenerateTCoordsToUseLength()
Control whether and how texture coordinates are produced.
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:69
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:39
void SetGenerateTCoordsToUseScalars()
Control whether and how texture coordinates are produced.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkTypeBool VaryWidth
object to represent cell connectivity
Definition: vtkCellArray.h:186
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:39
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.