VTK
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])
77  {this->SetParametricRange(tRange[0],tRange[1]);}
78  void GetParametricRange(double tRange[2]) const;
80 
82 
86  vtkSetMacro(ClampValue,vtkTypeBool);
87  vtkGetMacro(ClampValue,vtkTypeBool);
88  vtkBooleanMacro(ClampValue,vtkTypeBool);
90 
94  virtual void Compute () = 0;
95 
99  virtual double Evaluate (double t) = 0;
100 
104  int GetNumberOfPoints();
105 
109  void AddPoint (double t, double x);
110 
114  void RemovePoint (double t);
115 
119  void RemoveAllPoints ();
120 
122 
127  vtkSetMacro(Closed,vtkTypeBool);
128  vtkGetMacro(Closed,vtkTypeBool);
129  vtkBooleanMacro(Closed,vtkTypeBool);
131 
133 
149  vtkSetClampMacro(LeftConstraint,int,0,3);
150  vtkGetMacro(LeftConstraint,int);
151  vtkSetClampMacro(RightConstraint,int,0,3);
152  vtkGetMacro(RightConstraint,int);
154 
156 
160  vtkSetMacro(LeftValue,double);
161  vtkGetMacro(LeftValue,double);
162  vtkSetMacro(RightValue,double);
163  vtkGetMacro(RightValue,double);
165 
169  vtkMTimeType GetMTime() override;
170 
174  virtual void DeepCopy(vtkSpline *s);
175 
176 protected:
177  vtkSpline();
178  ~vtkSpline() override;
179 
182  double *Intervals;
183  double *Coefficients;
185  double LeftValue;
187  double RightValue;
190 
191  // Explicitly specify the parametric range.
192  double ParametricRange[2];
193 
194  // Helper methods
195  double ComputeLeftDerivative();
196  double ComputeRightDerivative();
197  int FindIndex(int size, double t);
198 
199 private:
200  vtkSpline(const vtkSpline&) = delete;
201  void operator=(const vtkSpline&) = delete;
202 };
203 
204 #endif
205 
vtkMTimeType ComputeTime
Definition: vtkSpline.h:180
abstract base class for most VTK objects
Definition: vtkObject.h:59
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:302
double * Intervals
Definition: vtkSpline.h:182
int LeftConstraint
Definition: vtkSpline.h:184
double RightValue
Definition: vtkSpline.h:187
vtkTypeBool ClampValue
Definition: vtkSpline.h:181
int vtkTypeBool
Definition: vtkABI.h:69
a simple class to control print indentation
Definition: vtkIndent.h:39
double * Coefficients
Definition: vtkSpline.h:183
spline abstract class for interpolating splines
Definition: vtkSpline.h:62
virtual vtkMTimeType GetMTime()
Return this object's modified time.
double LeftValue
Definition: vtkSpline.h:185
void SetParametricRange(double tRange[2])
Set/Get the parametric range.
Definition: vtkSpline.h:76
int RightConstraint
Definition: vtkSpline.h:186
vtkTypeBool Closed
Definition: vtkSpline.h:189
vtkPiecewiseFunction * PiecewiseFunction
Definition: vtkSpline.h:188