VTK  9.1.0
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 =========================================================================*/
76 #ifndef vtkSplineFilter_h
77 #define vtkSplineFilter_h
78 
79 #include "vtkFiltersGeneralModule.h" // For export macro
80 #include "vtkPolyDataAlgorithm.h"
81 
82 #define VTK_SUBDIVIDE_SPECIFIED 0
83 #define VTK_SUBDIVIDE_LENGTH 1
84 
85 #define VTK_TCOORDS_OFF 0
86 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
87 #define VTK_TCOORDS_FROM_LENGTH 2
88 #define VTK_TCOORDS_FROM_SCALARS 3
89 
90 class vtkCellArray;
91 class vtkCellData;
92 class vtkFloatArray;
93 class vtkPointData;
94 class vtkPoints;
95 class vtkSpline;
96 
97 class VTKFILTERSGENERAL_EXPORT vtkSplineFilter : public vtkPolyDataAlgorithm
98 {
99 public:
101  void PrintSelf(ostream& os, vtkIndent indent) override;
102 
107  static vtkSplineFilter* New();
108 
110 
114  vtkSetClampMacro(MaximumNumberOfSubdivisions, int, 1, VTK_INT_MAX);
115  vtkGetMacro(MaximumNumberOfSubdivisions, int);
117 
119 
122  vtkSetClampMacro(Subdivide, int, VTK_SUBDIVIDE_SPECIFIED, VTK_SUBDIVIDE_LENGTH);
123  vtkGetMacro(Subdivide, int);
124  void SetSubdivideToSpecified() { this->SetSubdivide(VTK_SUBDIVIDE_SPECIFIED); }
125  void SetSubdivideToLength() { this->SetSubdivide(VTK_SUBDIVIDE_LENGTH); }
126  const char* GetSubdivideAsString();
128 
130 
135  vtkSetClampMacro(NumberOfSubdivisions, int, 1, VTK_INT_MAX);
136  vtkGetMacro(NumberOfSubdivisions, int);
138 
140 
145  vtkSetClampMacro(Length, double, 0.0000001, VTK_DOUBLE_MAX);
146  vtkGetMacro(Length, double);
148 
150 
153  virtual void SetSpline(vtkSpline*);
154  vtkGetObjectMacro(Spline, vtkSpline);
156 
158 
165  vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
166  vtkGetMacro(GenerateTCoords, int);
167  void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
169  {
170  this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
171  }
172  void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
173  void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
176 
178 
184  vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
185  vtkGetMacro(TextureLength, double);
187 
188 protected:
190  ~vtkSplineFilter() override;
191 
192  // Usual data generation method
194 
198  double Length;
204  double TextureLength; // this length is mapped to [0,1) texture space
205 
206  // helper methods
208  vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, int genTCoords,
209  vtkFloatArray* newTCoords);
210 
211  void GenerateLine(vtkIdType offset, vtkIdType numGenPts, vtkIdType inCellId, vtkCellData* cd,
212  vtkCellData* outCD, vtkCellArray* newLines);
213 
214  // helper members
216 
217 private:
218  vtkSplineFilter(const vtkSplineFilter&) = delete;
219  void operator=(const vtkSplineFilter&) = delete;
220 };
221 
222 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:143
vtkSplineFilter::GeneratePoints
int GeneratePoints(vtkIdType offset, vtkIdType npts, const vtkIdType *pts, vtkPoints *inPts, vtkPoints *newPts, vtkPointData *pd, vtkPointData *outPD, int genTCoords, vtkFloatArray *newTCoords)
vtkSplineFilter::GenerateLine
void GenerateLine(vtkIdType offset, vtkIdType numGenPts, vtkIdType inCellId, vtkCellData *cd, vtkCellData *outCD, vtkCellArray *newLines)
VTK_SUBDIVIDE_SPECIFIED
#define VTK_SUBDIVIDE_SPECIFIED
Definition: vtkSplineFilter.h:82
vtkSplineFilter::RequestData
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:155
vtkSplineFilter::SetSubdivideToLength
void SetSubdivideToLength()
Specify how the number of subdivisions is determined.
Definition: vtkSplineFilter.h:125
VTK_TCOORDS_FROM_NORMALIZED_LENGTH
#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH
Definition: vtkSplineFilter.h:86
vtkSplineFilter::Subdivide
int Subdivide
Definition: vtkSplineFilter.h:196
VTK_TCOORDS_FROM_LENGTH
#define VTK_TCOORDS_FROM_LENGTH
Definition: vtkSplineFilter.h:87
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:142
vtkIdType
int vtkIdType
Definition: vtkType.h:332
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:145
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:145
vtkSplineFilter::GenerateTCoords
int GenerateTCoords
Definition: vtkSplineFilter.h:203
vtkSplineFilter::SetGenerateTCoordsToUseLength
void SetGenerateTCoordsToUseLength()
Control whether and how texture coordinates are produced.
Definition: vtkSplineFilter.h:172
vtkSplineFilter
generate uniformly subdivided polylines from a set of input polyline using a vtkSpline
Definition: vtkSplineFilter.h:98
vtkSplineFilter::NumberOfSubdivisions
int NumberOfSubdivisions
Definition: vtkSplineFilter.h:197
vtkSplineFilter::Spline
vtkSpline * Spline
Definition: vtkSplineFilter.h:199
vtkSplineFilter::GetSubdivideAsString
const char * GetSubdivideAsString()
Specify how the number of subdivisions is determined.
vtkSplineFilter::TCoordMap
vtkFloatArray * TCoordMap
Definition: vtkSplineFilter.h:215
VTK_TCOORDS_FROM_SCALARS
#define VTK_TCOORDS_FROM_SCALARS
Definition: vtkSplineFilter.h:88
vtkSplineFilter::MaximumNumberOfSubdivisions
int MaximumNumberOfSubdivisions
Definition: vtkSplineFilter.h:195
vtkPolyDataAlgorithm.h
vtkSplineFilter::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSplineFilter::~vtkSplineFilter
~vtkSplineFilter() override
vtkX3D::offset
@ offset
Definition: vtkX3D.h:444
vtkSplineFilter::SetGenerateTCoordsToUseScalars
void SetGenerateTCoordsToUseScalars()
Control whether and how texture coordinates are produced.
Definition: vtkSplineFilter.h:173
vtkCellData
represent and manipulate cell attribute data
Definition: vtkCellData.h:142
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkSplineFilter::ZSpline
vtkSpline * ZSpline
Definition: vtkSplineFilter.h:202
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:290
vtkSpline
spline abstract class for interpolating splines
Definition: vtkSpline.h:82
vtkSplineFilter::GetGenerateTCoordsAsString
const char * GetGenerateTCoordsAsString()
Control whether and how texture coordinates are produced.
vtkSplineFilter::TextureLength
double TextureLength
Definition: vtkSplineFilter.h:204
VTK_SUBDIVIDE_LENGTH
#define VTK_SUBDIVIDE_LENGTH
Definition: vtkSplineFilter.h:83
vtkSplineFilter::New
static vtkSplineFilter * New()
Construct the class with no limit on the number of subdivisions and using an instance of vtkCardinalS...
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:183
VTK_TCOORDS_OFF
#define VTK_TCOORDS_OFF
Definition: vtkSplineFilter.h:85
vtkSplineFilter::Length
double Length
Definition: vtkSplineFilter.h:198
vtkSplineFilter::vtkSplineFilter
vtkSplineFilter()
vtkSplineFilter::YSpline
vtkSpline * YSpline
Definition: vtkSplineFilter.h:201
vtkSplineFilter::SetSpline
virtual void SetSpline(vtkSpline *)
Specify an instance of vtkSpline to use to perform the interpolation.
vtkSplineFilter::SetGenerateTCoordsToOff
void SetGenerateTCoordsToOff()
Control whether and how texture coordinates are produced.
Definition: vtkSplineFilter.h:167
VTK_DOUBLE_MAX
#define VTK_DOUBLE_MAX
Definition: vtkType.h:165
vtkSplineFilter::XSpline
vtkSpline * XSpline
Definition: vtkSplineFilter.h:200
vtkSplineFilter::SetGenerateTCoordsToNormalizedLength
void SetGenerateTCoordsToNormalizedLength()
Control whether and how texture coordinates are produced.
Definition: vtkSplineFilter.h:168
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:151
vtkSplineFilter::SetSubdivideToSpecified
void SetSubdivideToSpecified()
Specify how the number of subdivisions is determined.
Definition: vtkSplineFilter.h:124