VTK  9.0.1
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 =========================================================================*/
54 #ifndef vtkSpline_h
55 #define vtkSpline_h
56 
57 #include "vtkCommonDataModelModule.h" // For export macro
58 #include "vtkObject.h"
59 
61 
62 class VTKCOMMONDATAMODEL_EXPORT vtkSpline : public vtkObject
63 {
64 public:
65  vtkTypeMacro(vtkSpline, vtkObject);
66  void PrintSelf(ostream& os, vtkIndent indent) override;
67 
69 
75  void SetParametricRange(double tMin, double tMax);
76  void SetParametricRange(double tRange[2]) { this->SetParametricRange(tRange[0], tRange[1]); }
77  void GetParametricRange(double tRange[2]) const;
79 
81 
85  vtkSetMacro(ClampValue, vtkTypeBool);
86  vtkGetMacro(ClampValue, vtkTypeBool);
87  vtkBooleanMacro(ClampValue, vtkTypeBool);
89 
93  virtual void Compute() = 0;
94 
98  virtual double Evaluate(double t) = 0;
99 
103  int GetNumberOfPoints();
104 
108  void AddPoint(double t, double x);
109 
113  void RemovePoint(double t);
114 
118  void RemoveAllPoints();
119 
121 
126  vtkSetMacro(Closed, vtkTypeBool);
127  vtkGetMacro(Closed, vtkTypeBool);
128  vtkBooleanMacro(Closed, vtkTypeBool);
130 
132 
148  vtkSetClampMacro(LeftConstraint, int, 0, 3);
149  vtkGetMacro(LeftConstraint, int);
150  vtkSetClampMacro(RightConstraint, int, 0, 3);
151  vtkGetMacro(RightConstraint, int);
153 
155 
159  vtkSetMacro(LeftValue, double);
160  vtkGetMacro(LeftValue, double);
161  vtkSetMacro(RightValue, double);
162  vtkGetMacro(RightValue, double);
164 
168  vtkMTimeType GetMTime() override;
169 
173  virtual void DeepCopy(vtkSpline* s);
174 
175 protected:
176  vtkSpline();
177  ~vtkSpline() override;
178 
181  double* Intervals;
182  double* Coefficients;
184  double LeftValue;
186  double RightValue;
189 
190  // Explicitly specify the parametric range.
191  double ParametricRange[2];
192 
193  // Helper methods
194  double ComputeLeftDerivative();
195  double ComputeRightDerivative();
196  int FindIndex(int size, double t);
197 
198 private:
199  vtkSpline(const vtkSpline&) = delete;
200  void operator=(const vtkSpline&) = delete;
201 };
202 
203 #endif
vtkMTimeType ComputeTime
Definition: vtkSpline.h:179
abstract base class for most VTK objects
Definition: vtkObject.h:62
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:293
double * Intervals
Definition: vtkSpline.h:181
int LeftConstraint
Definition: vtkSpline.h:183
double RightValue
Definition: vtkSpline.h:186
vtkTypeBool ClampValue
Definition: vtkSpline.h:180
int vtkTypeBool
Definition: vtkABI.h:69
a simple class to control print indentation
Definition: vtkIndent.h:33
double * Coefficients
Definition: vtkSpline.h:182
spline abstract class for interpolating splines
Definition: vtkSpline.h:62
virtual vtkMTimeType GetMTime()
Return this object's modified time.
double LeftValue
Definition: vtkSpline.h:184
void SetParametricRange(double tRange[2])
Set/Get the parametric range.
Definition: vtkSpline.h:76
int RightConstraint
Definition: vtkSpline.h:185
vtkTypeBool Closed
Definition: vtkSpline.h:188
vtkPiecewiseFunction * PiecewiseFunction
Definition: vtkSpline.h:187