VTK  9.3.20240423
vtkSpline.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
42#ifndef vtkSpline_h
43#define vtkSpline_h
44
45#include "vtkCommonDataModelModule.h" // For export macro
46#include "vtkObject.h"
47
48VTK_ABI_NAMESPACE_BEGIN
50
51class VTKCOMMONDATAMODEL_EXPORT vtkSpline : public vtkObject
52{
53public:
54 vtkTypeMacro(vtkSpline, vtkObject);
55 void PrintSelf(ostream& os, vtkIndent indent) override;
56
58
64 void SetParametricRange(double tMin, double tMax);
65 void SetParametricRange(double tRange[2]) { this->SetParametricRange(tRange[0], tRange[1]); }
66 void GetParametricRange(double tRange[2]) const;
68
70
74 vtkSetMacro(ClampValue, vtkTypeBool);
75 vtkGetMacro(ClampValue, vtkTypeBool);
76 vtkBooleanMacro(ClampValue, vtkTypeBool);
78
82 virtual void Compute() = 0;
83
87 virtual double Evaluate(double t) = 0;
88
93
97 void AddPoint(double t, double x);
98
107 void FillFromDataPointer(int nb, double* data);
108
112 void RemovePoint(double t);
113
118
120
125 vtkSetMacro(Closed, vtkTypeBool);
126 vtkGetMacro(Closed, vtkTypeBool);
127 vtkBooleanMacro(Closed, vtkTypeBool);
129
131
147 vtkSetClampMacro(LeftConstraint, int, 0, 3);
148 vtkGetMacro(LeftConstraint, int);
149 vtkSetClampMacro(RightConstraint, int, 0, 3);
150 vtkGetMacro(RightConstraint, int);
152
154
158 vtkSetMacro(LeftValue, double);
159 vtkGetMacro(LeftValue, double);
160 vtkSetMacro(RightValue, double);
161 vtkGetMacro(RightValue, double);
163
168
172 virtual void DeepCopy(vtkSpline* s);
173
174protected:
176 ~vtkSpline() override;
177
180 double* Intervals;
183 double LeftValue;
188
189 // Explicitly specify the parametric range.
190 double ParametricRange[2];
191
192 // Helper methods
195 int FindIndex(int size, double t);
196
197private:
198 vtkSpline(const vtkSpline&) = delete;
199 void operator=(const vtkSpline&) = delete;
200};
201
202VTK_ABI_NAMESPACE_END
203#endif
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
Defines a 1D piecewise function.
spline abstract class for interpolating splines
Definition vtkSpline.h:52
double RightValue
Definition vtkSpline.h:185
double * Intervals
Definition vtkSpline.h:180
vtkMTimeType GetMTime() override
Return the MTime also considering the Piecewise function.
int RightConstraint
Definition vtkSpline.h:184
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:65
int LeftConstraint
Definition vtkSpline.h:182
vtkTypeBool Closed
Definition vtkSpline.h:187
vtkPiecewiseFunction * PiecewiseFunction
Definition vtkSpline.h:186
virtual double Evaluate(double t)=0
Interpolate the value of the spline at parametric location of t.
double * Coefficients
Definition vtkSpline.h:181
int GetNumberOfPoints()
Return the number of points inserted thus far.
void FillFromDataPointer(int nb, double *data)
Add all the points to the list of points in one time, and then sort them only once.
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:178
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:179
void AddPoint(double t, double x)
Add a pair of points to be fit with the spline.
~vtkSpline() override
double LeftValue
Definition vtkSpline.h:183
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:64
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270