VTK: Common/DataModel/vtkSpline.h Source File

| VTK 9.3.1

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
48 VTK_ABI_NAMESPACE_BEGIN
49 class vtkPiecewiseFunction;
50
51 class VTKCOMMONDATAMODEL_EXPORT vtkSpline : public vtkObject
52 {
53 public:
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
92 int GetNumberOfPoints();
93
97 void AddPoint(double t, double x);
98
107 void FillFromDataPointer(int nb, double* data);
108
112 void RemovePoint(double t);
113
117 void RemoveAllPoints();
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
167 vtkMTimeType GetMTime() override;
168
172 virtual void DeepCopy(vtkSpline* s);
173
174 protected:
175 vtkSpline();
176 ~vtkSpline() override;
177
178 vtkMTimeType ComputeTime;
179 vtkTypeBool ClampValue;
180 double* Intervals;
181 double* Coefficients;
182 int LeftConstraint;
183 double LeftValue;
184 int RightConstraint;
185 double RightValue;
186 vtkPiecewiseFunction* PiecewiseFunction;
187 vtkTypeBool Closed;
188
189 // Explicitly specify the parametric range.
190 double ParametricRange[2];
191
192 // Helper methods
193 double ComputeLeftDerivative();
194 double ComputeRightDerivative();
195 int FindIndex(int size, double t);
196
197 private:
198 vtkSpline(const vtkSpline&) = delete;
199 void operator=(const vtkSpline&) = delete;
200 };
201
202 VTK_ABI_NAMESPACE_END
203 #endif
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkPiecewiseFunction
Defines a 1D piecewise function.
Definition: vtkPiecewiseFunction.h:50
vtkSpline
spline abstract class for interpolating splines
Definition: vtkSpline.h:52
vtkSpline::RightValue
double RightValue
Definition: vtkSpline.h:185
vtkSpline::Intervals
double * Intervals
Definition: vtkSpline.h:180
vtkSpline::GetMTime
vtkMTimeType GetMTime() override
Return the MTime also considering the Piecewise function.
vtkSpline::RightConstraint
int RightConstraint
Definition: vtkSpline.h:184
vtkSpline::GetParametricRange
void GetParametricRange(double tRange[2]) const
Set/Get the parametric range.
vtkSpline::FindIndex
int FindIndex(int size, double t)
vtkSpline::ComputeRightDerivative
double ComputeRightDerivative()
vtkSpline::SetParametricRange
void SetParametricRange(double tRange[2])
Set/Get the parametric range.
Definition: vtkSpline.h:65
vtkSpline::LeftConstraint
int LeftConstraint
Definition: vtkSpline.h:182
vtkSpline::Closed
vtkTypeBool Closed
Definition: vtkSpline.h:187
vtkSpline::PiecewiseFunction
vtkPiecewiseFunction * PiecewiseFunction
Definition: vtkSpline.h:186
vtkSpline::Evaluate
virtual double Evaluate(double t)=0
Interpolate the value of the spline at parametric location of t.
vtkSpline::Coefficients
double * Coefficients
Definition: vtkSpline.h:181
vtkSpline::GetNumberOfPoints
int GetNumberOfPoints()
Return the number of points inserted thus far.
vtkSpline::FillFromDataPointer
void FillFromDataPointer(int nb, double *data)
Add all the points to the list of points in one time, and then sort them only once.
vtkSpline::ComputeLeftDerivative
double ComputeLeftDerivative()
vtkSpline::vtkSpline
vtkSpline()
vtkSpline::RemoveAllPoints
void RemoveAllPoints()
Remove all points from the data.
vtkSpline::SetParametricRange
void SetParametricRange(double tMin, double tMax)
Set/Get the parametric range.
vtkSpline::ComputeTime
vtkMTimeType ComputeTime
Definition: vtkSpline.h:178
vtkSpline::RemovePoint
void RemovePoint(double t)
Remove a point from the data to be fit with the spline.
vtkSpline::Compute
virtual void Compute()=0
Compute the coefficients for the spline.
vtkSpline::ClampValue
vtkTypeBool ClampValue
Definition: vtkSpline.h:179
vtkSpline::AddPoint
void AddPoint(double t, double x)
Add a pair of points to be fit with the spline.
vtkSpline::~vtkSpline
~vtkSpline() override
vtkSpline::LeftValue
double LeftValue
Definition: vtkSpline.h:183
vtkSpline::DeepCopy
virtual void DeepCopy(vtkSpline *s)
Deep copy of spline data.
vtkSpline::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkX3D::size
@ size
Definition: vtkX3D.h:253
vtkX3D::data
@ data
Definition: vtkX3D.h:315
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:64
vtkObject.h
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270