VTK  9.0.20201130
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 =========================================================================*/
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 class vtkCellArray;
52 class vtkCellData;
53 class vtkFloatArray;
54 class vtkPointData;
55 class vtkPoints;
56 class vtkSpline;
57 
58 class VTKFILTERSGENERAL_EXPORT vtkSplineFilter : public vtkPolyDataAlgorithm
59 {
60 public:
62  void PrintSelf(ostream& os, vtkIndent indent) override;
63 
68  static vtkSplineFilter* New();
69 
71 
75  vtkSetClampMacro(MaximumNumberOfSubdivisions, int, 1, VTK_INT_MAX);
76  vtkGetMacro(MaximumNumberOfSubdivisions, int);
78 
80 
83  vtkSetClampMacro(Subdivide, int, VTK_SUBDIVIDE_SPECIFIED, VTK_SUBDIVIDE_LENGTH);
84  vtkGetMacro(Subdivide, int);
85  void SetSubdivideToSpecified() { this->SetSubdivide(VTK_SUBDIVIDE_SPECIFIED); }
86  void SetSubdivideToLength() { this->SetSubdivide(VTK_SUBDIVIDE_LENGTH); }
87  const char* GetSubdivideAsString();
89 
91 
96  vtkSetClampMacro(NumberOfSubdivisions, int, 1, VTK_INT_MAX);
97  vtkGetMacro(NumberOfSubdivisions, int);
99 
101 
106  vtkSetClampMacro(Length, double, 0.0000001, VTK_DOUBLE_MAX);
107  vtkGetMacro(Length, double);
109 
111 
114  virtual void SetSpline(vtkSpline*);
115  vtkGetObjectMacro(Spline, vtkSpline);
117 
119 
126  vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
127  vtkGetMacro(GenerateTCoords, int);
128  void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
130  {
131  this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
132  }
133  void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
134  void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
135  const char* GetGenerateTCoordsAsString();
137 
139 
145  vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
146  vtkGetMacro(TextureLength, double);
148 
149 protected:
150  vtkSplineFilter();
151  ~vtkSplineFilter() override;
152 
153  // Usual data generation method
155 
159  double Length;
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, int genTCoords,
170  vtkFloatArray* newTCoords);
171 
172  void GenerateLine(vtkIdType offset, vtkIdType numGenPts, vtkIdType inCellId, vtkCellData* cd,
173  vtkCellData* outCD, vtkCellArray* newLines);
174 
175  // helper members
177 
178 private:
179  vtkSplineFilter(const vtkSplineFilter&) = delete;
180  void operator=(const vtkSplineFilter&) = delete;
181 };
182 
183 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:33
VTK_SUBDIVIDE_SPECIFIED
#define VTK_SUBDIVIDE_SPECIFIED
Definition: vtkSplineFilter.h:43
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:147
vtkSplineFilter::SetSubdivideToLength
void SetSubdivideToLength()
Definition: vtkSplineFilter.h:86
VTK_TCOORDS_FROM_NORMALIZED_LENGTH
#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH
Definition: vtkSplineFilter.h:47
vtkSplineFilter::Subdivide
int Subdivide
Definition: vtkSplineFilter.h:157
VTK_TCOORDS_FROM_LENGTH
#define VTK_TCOORDS_FROM_LENGTH
Definition: vtkSplineFilter.h:48
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:32
vtkIdType
int vtkIdType
Definition: vtkType.h:330
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:35
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkSplineFilter::GenerateTCoords
int GenerateTCoords
Definition: vtkSplineFilter.h:164
vtkSplineFilter::SetGenerateTCoordsToUseLength
void SetGenerateTCoordsToUseLength()
Definition: vtkSplineFilter.h:133
vtkSplineFilter
generate uniformly subdivided polylines from a set of input polyline using a vtkSpline
Definition: vtkSplineFilter.h:58
vtkSplineFilter::NumberOfSubdivisions
int NumberOfSubdivisions
Definition: vtkSplineFilter.h:158
vtkSplineFilter::Spline
vtkSpline * Spline
Definition: vtkSplineFilter.h:160
vtkPolyDataAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSplineFilter::TCoordMap
vtkFloatArray * TCoordMap
Definition: vtkSplineFilter.h:176
VTK_TCOORDS_FROM_SCALARS
#define VTK_TCOORDS_FROM_SCALARS
Definition: vtkSplineFilter.h:49
vtkSplineFilter::MaximumNumberOfSubdivisions
int MaximumNumberOfSubdivisions
Definition: vtkSplineFilter.h:156
vtkPolyDataAlgorithm.h
vtkX3D::offset
Definition: vtkX3D.h:444
vtkPolyDataAlgorithm::RequestData
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
vtkSplineFilter::SetGenerateTCoordsToUseScalars
void SetGenerateTCoordsToUseScalars()
Definition: vtkSplineFilter.h:134
vtkCellData
represent and manipulate cell attribute data
Definition: vtkCellData.h:32
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkSplineFilter::ZSpline
vtkSpline * ZSpline
Definition: vtkSplineFilter.h:163
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:180
vtkSpline
spline abstract class for interpolating splines
Definition: vtkSpline.h:62
vtkSplineFilter::TextureLength
double TextureLength
Definition: vtkSplineFilter.h:165
VTK_SUBDIVIDE_LENGTH
#define VTK_SUBDIVIDE_LENGTH
Definition: vtkSplineFilter.h:44
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
VTK_TCOORDS_OFF
#define VTK_TCOORDS_OFF
Definition: vtkSplineFilter.h:46
vtkSplineFilter::Length
double Length
Definition: vtkSplineFilter.h:159
vtkSplineFilter::YSpline
vtkSpline * YSpline
Definition: vtkSplineFilter.h:162
vtkSplineFilter::SetGenerateTCoordsToOff
void SetGenerateTCoordsToOff()
Definition: vtkSplineFilter.h:128
VTK_DOUBLE_MAX
#define VTK_DOUBLE_MAX
Definition: vtkType.h:157
vtkPolyDataAlgorithm::New
static vtkPolyDataAlgorithm * New()
vtkSplineFilter::XSpline
vtkSpline * XSpline
Definition: vtkSplineFilter.h:161
vtkSplineFilter::SetGenerateTCoordsToNormalizedLength
void SetGenerateTCoordsToNormalizedLength()
Definition: vtkSplineFilter.h:129
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:41
vtkSplineFilter::SetSubdivideToSpecified
void SetSubdivideToSpecified()
Definition: vtkSplineFilter.h:85