VTK  9.0.1
vtkSpline.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSpline.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 =========================================================================*/
54 #ifndef vtkSpline_h
55 #define vtkSpline_h
56 
57 #include "vtkCommonDataModelModule.h" // For export macro
58 #include "vtkObject.h"
59 
61 
62 class VTKCOMMONDATAMODEL_EXPORT vtkSpline : public vtkObject
63 {
64 public:
65  vtkTypeMacro(vtkSpline, vtkObject);
66  void PrintSelf(ostream& os, vtkIndent indent) override;
67 
69 
75  void SetParametricRange(double tMin, double tMax);
76  void SetParametricRange(double tRange[2]) { this->SetParametricRange(tRange[0], tRange[1]); }
77  void GetParametricRange(double tRange[2]) const;
79 
81 
85  vtkSetMacro(ClampValue, vtkTypeBool);
86  vtkGetMacro(ClampValue, vtkTypeBool);
87  vtkBooleanMacro(ClampValue, vtkTypeBool);
89 
93  virtual void Compute() = 0;
94 
98  virtual double Evaluate(double t) = 0;
99 
104 
108  void AddPoint(double t, double x);
109 
113  void RemovePoint(double t);
114 
119 
121 
126  vtkSetMacro(Closed, vtkTypeBool);
127  vtkGetMacro(Closed, vtkTypeBool);
128  vtkBooleanMacro(Closed, vtkTypeBool);
130 
132 
148  vtkSetClampMacro(LeftConstraint, int, 0, 3);
149  vtkGetMacro(LeftConstraint, int);
150  vtkSetClampMacro(RightConstraint, int, 0, 3);
151  vtkGetMacro(RightConstraint, int);
153 
155 
159  vtkSetMacro(LeftValue, double);
160  vtkGetMacro(LeftValue, double);
161  vtkSetMacro(RightValue, double);
162  vtkGetMacro(RightValue, double);
164 
168  vtkMTimeType GetMTime() override;
169 
173  virtual void DeepCopy(vtkSpline* s);
174 
175 protected:
177  ~vtkSpline() override;
178 
181  double* Intervals;
182  double* Coefficients;
184  double LeftValue;
186  double RightValue;
189 
190  // Explicitly specify the parametric range.
191  double ParametricRange[2];
192 
193  // Helper methods
196  int FindIndex(int size, double t);
197 
198 private:
199  vtkSpline(const vtkSpline&) = delete;
200  void operator=(const vtkSpline&) = delete;
201 };
202 
203 #endif
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract base class for most VTK objects
Definition: vtkObject.h:63
Defines a 1D piecewise function.
spline abstract class for interpolating splines
Definition: vtkSpline.h:63
double RightValue
Definition: vtkSpline.h:186
double * Intervals
Definition: vtkSpline.h:181
vtkMTimeType GetMTime() override
Return the MTime also considering the Piecewise function.
int RightConstraint
Definition: vtkSpline.h:185
void GetParametricRange(double tRange[2]) const
int FindIndex(int size, double t)
double ComputeRightDerivative()
void SetParametricRange(double tRange[2])
Definition: vtkSpline.h:76
int LeftConstraint
Definition: vtkSpline.h:183
vtkTypeBool Closed
Definition: vtkSpline.h:188
vtkPiecewiseFunction * PiecewiseFunction
Definition: vtkSpline.h:187
virtual double Evaluate(double t)=0
Interpolate the value of the spline at parametric location of t.
double * Coefficients
Definition: vtkSpline.h:182
int GetNumberOfPoints()
Return the number of points inserted thus far.
double ComputeLeftDerivative()
void RemoveAllPoints()
Remove all points from the data.
void SetParametricRange(double tMin, double tMax)
Set/Get the parametric range.
vtkMTimeType ComputeTime
Definition: vtkSpline.h:179
void RemovePoint(double t)
Remove a point from the data to be fit with the spline.
virtual void Compute()=0
Compute the coefficients for the spline.
vtkTypeBool ClampValue
Definition: vtkSpline.h:180
void AddPoint(double t, double x)
Add a pair of points to be fit with the spline.
~vtkSpline() override
double LeftValue
Definition: vtkSpline.h:184
virtual void DeepCopy(vtkSpline *s)
Deep copy of spline data.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
@ size
Definition: vtkX3D.h:259
int vtkTypeBool
Definition: vtkABI.h:69
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293