VTK  9.2.20230527
vtkSplineFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSplineFilter.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 =========================================================================*/
79 #ifndef vtkSplineFilter_h
80 #define vtkSplineFilter_h
81 
82 #include "vtkFiltersGeneralModule.h" // For export macro
83 #include "vtkPolyDataAlgorithm.h"
84 
85 #define VTK_SUBDIVIDE_SPECIFIED 0
86 #define VTK_SUBDIVIDE_LENGTH 1
87 
88 #define VTK_TCOORDS_OFF 0
89 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
90 #define VTK_TCOORDS_FROM_LENGTH 2
91 #define VTK_TCOORDS_FROM_SCALARS 3
92 
93 VTK_ABI_NAMESPACE_BEGIN
94 class vtkCellArray;
95 class vtkCellData;
96 class vtkFloatArray;
97 class vtkPointData;
98 class vtkPoints;
99 class vtkSpline;
100 
101 class VTKFILTERSGENERAL_EXPORT vtkSplineFilter : public vtkPolyDataAlgorithm
102 {
103 public:
105  void PrintSelf(ostream& os, vtkIndent indent) override;
106 
111  static vtkSplineFilter* New();
112 
114 
118  vtkSetClampMacro(MaximumNumberOfSubdivisions, int, 1, VTK_INT_MAX);
119  vtkGetMacro(MaximumNumberOfSubdivisions, int);
121 
123 
126  vtkSetClampMacro(Subdivide, int, VTK_SUBDIVIDE_SPECIFIED, VTK_SUBDIVIDE_LENGTH);
127  vtkGetMacro(Subdivide, int);
128  void SetSubdivideToSpecified() { this->SetSubdivide(VTK_SUBDIVIDE_SPECIFIED); }
129  void SetSubdivideToLength() { this->SetSubdivide(VTK_SUBDIVIDE_LENGTH); }
130  const char* GetSubdivideAsString();
132 
134 
139  vtkSetClampMacro(NumberOfSubdivisions, int, 1, VTK_INT_MAX);
140  vtkGetMacro(NumberOfSubdivisions, int);
142 
144 
149  vtkSetClampMacro(Length, double, 0.0000001, VTK_DOUBLE_MAX);
150  vtkGetMacro(Length, double);
152 
154 
157  virtual void SetSpline(vtkSpline*);
158  vtkGetObjectMacro(Spline, vtkSpline);
160 
162 
169  vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
170  vtkGetMacro(GenerateTCoords, int);
171  void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
173  {
174  this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
175  }
176  void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
177  void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
180 
182 
188  vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
189  vtkGetMacro(TextureLength, double);
191 
192 protected:
194  ~vtkSplineFilter() override;
195 
196  // Usual data generation method
198 
202  double Length;
208  double TextureLength; // this length is mapped to [0,1) texture space
209 
210  // helper methods
212  vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, int genTCoords,
213  vtkFloatArray* newTCoords);
214 
215  void GenerateLine(vtkIdType offset, vtkIdType numGenPts, vtkIdType inCellId, vtkCellData* cd,
216  vtkCellData* outCD, vtkCellArray* newLines);
217 
218  // helper members
220 
221 private:
222  vtkSplineFilter(const vtkSplineFilter&) = delete;
223  void operator=(const vtkSplineFilter&) = delete;
224 };
225 
226 VTK_ABI_NAMESPACE_END
227 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:297
represent and manipulate cell attribute data
Definition: vtkCellData.h:152
dynamic, self-adjusting array of float
a simple class to control print indentation
Definition: vtkIndent.h:120
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate point attribute data
Definition: vtkPointData.h:151
represent and manipulate 3D points
Definition: vtkPoints.h:150
Superclass for algorithms that produce only polydata as output.
generate uniformly subdivided polylines from a set of input polyline using a vtkSpline
void SetGenerateTCoordsToNormalizedLength()
Control whether and how texture coordinates are produced.
void SetGenerateTCoordsToOff()
Control whether and how texture coordinates are produced.
void SetGenerateTCoordsToUseScalars()
Control whether and how texture coordinates are produced.
vtkSpline * XSpline
const char * GetSubdivideAsString()
Specify how the number of subdivisions is determined.
vtkSpline * ZSpline
vtkSpline * Spline
void SetSubdivideToLength()
Specify how the number of subdivisions is determined.
~vtkSplineFilter() override
int GeneratePoints(vtkIdType offset, vtkIdType npts, const vtkIdType *pts, vtkPoints *inPts, vtkPoints *newPts, vtkPointData *pd, vtkPointData *outPD, int genTCoords, vtkFloatArray *newTCoords)
void GenerateLine(vtkIdType offset, vtkIdType numGenPts, vtkIdType inCellId, vtkCellData *cd, vtkCellData *outCD, vtkCellArray *newLines)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSpline * YSpline
virtual void SetSpline(vtkSpline *)
Specify an instance of vtkSpline to use to perform the interpolation.
vtkFloatArray * TCoordMap
void SetSubdivideToSpecified()
Specify how the number of subdivisions is determined.
void SetGenerateTCoordsToUseLength()
Control whether and how texture coordinates are produced.
static vtkSplineFilter * New()
Construct the class with no limit on the number of subdivisions and using an instance of vtkCardinalS...
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
const char * GetGenerateTCoordsAsString()
Control whether and how texture coordinates are produced.
spline abstract class for interpolating splines
Definition: vtkSpline.h:83
@ offset
Definition: vtkX3D.h:450
#define VTK_TCOORDS_FROM_SCALARS
#define VTK_TCOORDS_FROM_LENGTH
#define VTK_SUBDIVIDE_LENGTH
#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH
#define VTK_TCOORDS_OFF
#define VTK_SUBDIVIDE_SPECIFIED
int vtkIdType
Definition: vtkType.h:327
#define VTK_DOUBLE_MAX
Definition: vtkType.h:166
#define VTK_INT_MAX
Definition: vtkType.h:156