VTK  9.3.1
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
28 #ifndef vtkSplineFilter_h
29 #define vtkSplineFilter_h
30 
31 #include "vtkFiltersGeneralModule.h" // For export macro
32 #include "vtkPolyDataAlgorithm.h"
33 
34 #define VTK_SUBDIVIDE_SPECIFIED 0
35 #define VTK_SUBDIVIDE_LENGTH 1
36 
37 #define VTK_TCOORDS_OFF 0
38 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
39 #define VTK_TCOORDS_FROM_LENGTH 2
40 #define VTK_TCOORDS_FROM_SCALARS 3
41 
42 VTK_ABI_NAMESPACE_BEGIN
43 class vtkCellArray;
44 class vtkCellData;
45 class vtkFloatArray;
46 class vtkPointData;
47 class vtkPoints;
48 class vtkSpline;
49 
50 class VTKFILTERSGENERAL_EXPORT vtkSplineFilter : public vtkPolyDataAlgorithm
51 {
52 public:
54  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
60  static vtkSplineFilter* New();
61 
63 
67  vtkSetClampMacro(MaximumNumberOfSubdivisions, int, 1, VTK_INT_MAX);
68  vtkGetMacro(MaximumNumberOfSubdivisions, int);
70 
72 
75  vtkSetClampMacro(Subdivide, int, VTK_SUBDIVIDE_SPECIFIED, VTK_SUBDIVIDE_LENGTH);
76  vtkGetMacro(Subdivide, int);
77  void SetSubdivideToSpecified() { this->SetSubdivide(VTK_SUBDIVIDE_SPECIFIED); }
78  void SetSubdivideToLength() { this->SetSubdivide(VTK_SUBDIVIDE_LENGTH); }
79  const char* GetSubdivideAsString();
81 
83 
88  vtkSetClampMacro(NumberOfSubdivisions, int, 1, VTK_INT_MAX);
89  vtkGetMacro(NumberOfSubdivisions, int);
91 
93 
98  vtkSetClampMacro(Length, double, 0.0000001, VTK_DOUBLE_MAX);
99  vtkGetMacro(Length, double);
101 
103 
106  virtual void SetSpline(vtkSpline*);
107  vtkGetObjectMacro(Spline, vtkSpline);
109 
111 
118  vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
119  vtkGetMacro(GenerateTCoords, int);
120  void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
122  {
123  this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
124  }
125  void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
126  void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
127  const char* GetGenerateTCoordsAsString();
129 
131 
137  vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
138  vtkGetMacro(TextureLength, double);
140 
141 protected:
142  vtkSplineFilter();
143  ~vtkSplineFilter() override;
144 
145  // Usual data generation method
147 
151  double Length;
157  double TextureLength; // this length is mapped to [0,1) texture space
158 
159  // helper methods
160  int GeneratePoints(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkPoints* inPts,
161  vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, int genTCoords,
162  vtkFloatArray* newTCoords);
163 
164  void GenerateLine(vtkIdType offset, vtkIdType numGenPts, vtkIdType inCellId, vtkCellData* cd,
165  vtkCellData* outCD, vtkCellArray* newLines);
166 
167  // helper members
169 
170 private:
171  vtkSplineFilter(const vtkSplineFilter&) = delete;
172  void operator=(const vtkSplineFilter&) = delete;
173 };
174 
175 VTK_ABI_NAMESPACE_END
176 #endif
#define VTK_SUBDIVIDE_SPECIFIED
void SetGenerateTCoordsToOff()
Control whether and how texture coordinates are produced.
#define VTK_TCOORDS_FROM_LENGTH
represent and manipulate point attribute data
Definition: vtkPointData.h:29
#define VTK_DOUBLE_MAX
Definition: vtkType.h:154
Store vtkAlgorithm input/output information.
generate uniformly subdivided polylines from a set of input polyline using a vtkSpline ...
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
#define VTK_INT_MAX
Definition: vtkType.h:144
vtkSpline * XSpline
represent and manipulate cell attribute data
Definition: vtkCellData.h:30
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:30
#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH
void SetSubdivideToLength()
Specify how the number of subdivisions is determined.
int vtkIdType
Definition: vtkType.h:315
static vtkPolyDataAlgorithm * New()
void SetSubdivideToSpecified()
Specify how the number of subdivisions is determined.
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:28
spline abstract class for interpolating splines
Definition: vtkSpline.h:51
#define VTK_TCOORDS_OFF
#define VTK_TCOORDS_FROM_SCALARS
object to represent cell connectivity
Definition: vtkCellArray.h:175
void SetGenerateTCoordsToNormalizedLength()
Control whether and how texture coordinates are produced.
Store zero or more vtkInformation instances.
vtkSpline * YSpline
vtkFloatArray * TCoordMap
#define VTK_SUBDIVIDE_LENGTH
void SetGenerateTCoordsToUseScalars()
Control whether and how texture coordinates are produced.
vtkSpline * ZSpline
void SetGenerateTCoordsToUseLength()
Control whether and how texture coordinates are produced.
represent and manipulate 3D points
Definition: vtkPoints.h:28
vtkSpline * Spline
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.