VTK  9.1.0
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=========================================================================*/
73#ifndef vtkSpline_h
74#define vtkSpline_h
75
76#include "vtkCommonDataModelModule.h" // For export macro
77#include "vtkObject.h"
78
80
81class VTKCOMMONDATAMODEL_EXPORT vtkSpline : public vtkObject
82{
83public:
84 vtkTypeMacro(vtkSpline, vtkObject);
85 void PrintSelf(ostream& os, vtkIndent indent) override;
86
88
94 void SetParametricRange(double tMin, double tMax);
95 void SetParametricRange(double tRange[2]) { this->SetParametricRange(tRange[0], tRange[1]); }
96 void GetParametricRange(double tRange[2]) const;
98
100
104 vtkSetMacro(ClampValue, vtkTypeBool);
105 vtkGetMacro(ClampValue, vtkTypeBool);
106 vtkBooleanMacro(ClampValue, vtkTypeBool);
108
112 virtual void Compute() = 0;
113
117 virtual double Evaluate(double t) = 0;
118
123
127 void AddPoint(double t, double x);
128
132 void RemovePoint(double t);
133
138
140
145 vtkSetMacro(Closed, vtkTypeBool);
146 vtkGetMacro(Closed, vtkTypeBool);
147 vtkBooleanMacro(Closed, vtkTypeBool);
149
151
167 vtkSetClampMacro(LeftConstraint, int, 0, 3);
168 vtkGetMacro(LeftConstraint, int);
169 vtkSetClampMacro(RightConstraint, int, 0, 3);
170 vtkGetMacro(RightConstraint, int);
172
174
178 vtkSetMacro(LeftValue, double);
179 vtkGetMacro(LeftValue, double);
180 vtkSetMacro(RightValue, double);
181 vtkGetMacro(RightValue, double);
183
188
192 virtual void DeepCopy(vtkSpline* s);
193
194protected:
196 ~vtkSpline() override;
197
200 double* Intervals;
203 double LeftValue;
208
209 // Explicitly specify the parametric range.
210 double ParametricRange[2];
211
212 // Helper methods
215 int FindIndex(int size, double t);
216
217private:
218 vtkSpline(const vtkSpline&) = delete;
219 void operator=(const vtkSpline&) = delete;
220};
221
222#endif
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract base class for most VTK objects
Definition: vtkObject.h:82
Defines a 1D piecewise function.
spline abstract class for interpolating splines
Definition: vtkSpline.h:82
double RightValue
Definition: vtkSpline.h:205
double * Intervals
Definition: vtkSpline.h:200
vtkMTimeType GetMTime() override
Return the MTime also considering the Piecewise function.
int RightConstraint
Definition: vtkSpline.h:204
void GetParametricRange(double tRange[2]) const
Set/Get the parametric range.
int FindIndex(int size, double t)
double ComputeRightDerivative()
void SetParametricRange(double tRange[2])
Set/Get the parametric range.
Definition: vtkSpline.h:95
int LeftConstraint
Definition: vtkSpline.h:202
vtkTypeBool Closed
Definition: vtkSpline.h:207
vtkPiecewiseFunction * PiecewiseFunction
Definition: vtkSpline.h:206
virtual double Evaluate(double t)=0
Interpolate the value of the spline at parametric location of t.
double * Coefficients
Definition: vtkSpline.h:201
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:198
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:199
void AddPoint(double t, double x)
Add a pair of points to be fit with the spline.
~vtkSpline() override
double LeftValue
Definition: vtkSpline.h:203
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.
int vtkTypeBool
Definition: vtkABI.h:69
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287