VTK  9.3.0
vtkSplineFilter.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
37 #ifndef vtkSplineFilter_h
38 #define vtkSplineFilter_h
39 
40 #include "vtkFiltersGeneralModule.h" // For export macro
41 #include "vtkPolyDataAlgorithm.h"
42 
43 #define VTK_SUBDIVIDE_SPECIFIED 0
44 #define VTK_SUBDIVIDE_LENGTH 1
45 
46 #define VTK_TCOORDS_OFF 0
47 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
48 #define VTK_TCOORDS_FROM_LENGTH 2
49 #define VTK_TCOORDS_FROM_SCALARS 3
50 
51 VTK_ABI_NAMESPACE_BEGIN
52 class vtkCellArray;
53 class vtkCellData;
54 class vtkFloatArray;
55 class vtkPointData;
56 class vtkPoints;
57 class vtkSpline;
58 
59 class VTKFILTERSGENERAL_EXPORT vtkSplineFilter : public vtkPolyDataAlgorithm
60 {
61 public:
63  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
69  static vtkSplineFilter* New();
70 
72 
76  vtkSetClampMacro(MaximumNumberOfSubdivisions, int, 1, VTK_INT_MAX);
77  vtkGetMacro(MaximumNumberOfSubdivisions, int);
79 
81 
84  vtkSetClampMacro(Subdivide, int, VTK_SUBDIVIDE_SPECIFIED, VTK_SUBDIVIDE_LENGTH);
85  vtkGetMacro(Subdivide, int);
86  void SetSubdivideToSpecified() { this->SetSubdivide(VTK_SUBDIVIDE_SPECIFIED); }
87  void SetSubdivideToLength() { this->SetSubdivide(VTK_SUBDIVIDE_LENGTH); }
88  const char* GetSubdivideAsString();
90 
92 
97  vtkSetClampMacro(NumberOfSubdivisions, int, 1, VTK_INT_MAX);
98  vtkGetMacro(NumberOfSubdivisions, int);
100 
102 
107  vtkSetClampMacro(Length, double, 0.0000001, VTK_DOUBLE_MAX);
108  vtkGetMacro(Length, double);
110 
112 
115  virtual void SetSpline(vtkSpline*);
116  vtkGetObjectMacro(Spline, vtkSpline);
118 
120 
127  vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
128  vtkGetMacro(GenerateTCoords, int);
129  void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
131  {
132  this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
133  }
134  void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
135  void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
138 
140 
146  vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
147  vtkGetMacro(TextureLength, double);
149 
150 protected:
152  ~vtkSplineFilter() override;
153 
154  // Usual data generation method
156 
160  double Length;
166  double TextureLength; // this length is mapped to [0,1) texture space
167 
168  // helper methods
170  vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, int genTCoords,
171  vtkFloatArray* newTCoords);
172 
173  void GenerateLine(vtkIdType offset, vtkIdType numGenPts, vtkIdType inCellId, vtkCellData* cd,
174  vtkCellData* outCD, vtkCellArray* newLines);
175 
176  // helper members
178 
179 private:
180  vtkSplineFilter(const vtkSplineFilter&) = delete;
181  void operator=(const vtkSplineFilter&) = delete;
182 };
183 
184 VTK_ABI_NAMESPACE_END
185 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:185
represent and manipulate cell attribute data
Definition: vtkCellData.h:40
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.
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:52
@ offset
Definition: vtkX3D.h:438
#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:315
#define VTK_DOUBLE_MAX
Definition: vtkType.h:154
#define VTK_INT_MAX
Definition: vtkType.h:144