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
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 
180  double* Intervals;
181  double* Coefficients;
183  double LeftValue;
185  double RightValue;
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
vtkMTimeType ComputeTime
Definition: vtkSpline.h:178
abstract base class for most VTK objects
Definition: vtkObject.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Defines a 1D piecewise function.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
double * Intervals
Definition: vtkSpline.h:180
int LeftConstraint
Definition: vtkSpline.h:182
double RightValue
Definition: vtkSpline.h:185
vtkTypeBool ClampValue
Definition: vtkSpline.h:179
int vtkTypeBool
Definition: vtkABI.h:64
a simple class to control print indentation
Definition: vtkIndent.h:28
double * Coefficients
Definition: vtkSpline.h:181
spline abstract class for interpolating splines
Definition: vtkSpline.h:51
virtual vtkMTimeType GetMTime()
Return this object's modified time.
double LeftValue
Definition: vtkSpline.h:183
void SetParametricRange(double tRange[2])
Set/Get the parametric range.
Definition: vtkSpline.h:65
int RightConstraint
Definition: vtkSpline.h:184
vtkTypeBool Closed
Definition: vtkSpline.h:187
vtkPiecewiseFunction * PiecewiseFunction
Definition: vtkSpline.h:186