VTK  9.7.20260916
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
41
42#ifndef vtkSpline_h
43#define vtkSpline_h
44
45#include "vtkCommonDataModelModule.h" // For export macro
46#include "vtkObject.h"
47#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
48
49VTK_ABI_NAMESPACE_BEGIN
51
52class VTKCOMMONDATAMODEL_EXPORT VTK_MARSHALAUTO vtkSpline : public vtkObject
53{
54public:
55 vtkTypeMacro(vtkSpline, vtkObject);
56 void PrintSelf(ostream& os, vtkIndent indent) override;
57
59
65 void SetParametricRange(double tMin, double tMax);
66 void SetParametricRange(double tRange[2]) { this->SetParametricRange(tRange[0], tRange[1]); }
67 void GetParametricRange(double tRange[2]) const;
68 vtkGetVector2Macro(ParametricRange, double);
70
72
76 vtkSetMacro(ClampValue, vtkTypeBool);
77 vtkGetMacro(ClampValue, vtkTypeBool);
78 vtkBooleanMacro(ClampValue, vtkTypeBool);
80
82
88
92 virtual void Compute() = 0;
93
97 virtual double Evaluate(double t) = 0;
98
103
107 void AddPoint(double t, double x);
108
117 void FillFromDataPointer(int nb, double* data);
118
122 void RemovePoint(double t);
123
128
130
135 vtkSetMacro(Closed, vtkTypeBool);
136 vtkGetMacro(Closed, vtkTypeBool);
137 vtkBooleanMacro(Closed, vtkTypeBool);
139
141
157 vtkSetClampMacro(LeftConstraint, int, 0, 3);
158 vtkGetMacro(LeftConstraint, int);
159 vtkSetClampMacro(RightConstraint, int, 0, 3);
160 vtkGetMacro(RightConstraint, int);
162
164
168 vtkSetMacro(LeftValue, double);
169 vtkGetMacro(LeftValue, double);
170 vtkSetMacro(RightValue, double);
171 vtkGetMacro(RightValue, double);
173
178
182 virtual void DeepCopy(vtkSpline* s);
183
184protected:
186 ~vtkSpline() override;
187
190 double* Intervals;
193 double LeftValue;
198
199 // Explicitly specify the parametric range.
201
202 // Helper methods
205 int FindIndex(int size, double t);
206
207private:
208 vtkSpline(const vtkSpline&) = delete;
209 void operator=(const vtkSpline&) = delete;
210};
211
212VTK_ABI_NAMESPACE_END
213#endif
a simple class to control print indentation
Definition vtkIndent.h:108
Defines a 1D piecewise function.
double RightValue
Definition vtkSpline.h:195
double * Intervals
Definition vtkSpline.h:190
vtkMTimeType GetMTime() override
Return the MTime also considering the Piecewise function.
void SetPiecewiseFunction(vtkPiecewiseFunction *pwf)
Set/Get PiecewiseFunction.
int RightConstraint
Definition vtkSpline.h:194
void GetParametricRange(double tRange[2]) const
Set/Get the parametric range.
double ParametricRange[2]
Definition vtkSpline.h:200
int FindIndex(int size, double t)
double ComputeRightDerivative()
void SetParametricRange(double tRange[2])
Set/Get the parametric range.
Definition vtkSpline.h:66
int LeftConstraint
Definition vtkSpline.h:192
vtkTypeBool Closed
Definition vtkSpline.h:197
vtkPiecewiseFunction * PiecewiseFunction
Definition vtkSpline.h:196
virtual double Evaluate(double t)=0
Interpolate the value of the spline at parametric location of t.
double * Coefficients
Definition vtkSpline.h:191
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:188
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:189
void AddPoint(double t, double x)
Add a pair of points to be fit with the spline.
~vtkSpline() override
double LeftValue
Definition vtkSpline.h:193
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:318
#define VTK_MARSHALAUTO