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
62class VTKCOMMONDATAMODEL_EXPORT vtkSpline : public vtkObject
63{
64public:
65 vtkTypeMacro(vtkSpline,vtkObject);
66 void PrintSelf(ostream& os, vtkIndent indent) VTK_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,int);
87 vtkGetMacro(ClampValue,int);
88 vtkBooleanMacro(ClampValue,int);
90
94 virtual void Compute () = 0;
95
99 virtual double Evaluate (double t) = 0;
100
105
109 void AddPoint (double t, double x);
110
114 void RemovePoint (double t);
115
120
122
127 vtkSetMacro(Closed,int);
128 vtkGetMacro(Closed,int);
129 vtkBooleanMacro(Closed,int);
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() VTK_OVERRIDE;
170
174 virtual void DeepCopy(vtkSpline *s);
175
176protected:
178 ~vtkSpline() VTK_OVERRIDE;
179
180 vtkMTimeType ComputeTime;
181 int ClampValue;
182 double *Intervals;
183 double *Coefficients;
184 int LeftConstraint;
185 double LeftValue;
186 int RightConstraint;
187 double RightValue;
188 vtkPiecewiseFunction *PiecewiseFunction;
189 int Closed;
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
199private:
200 vtkSpline(const vtkSpline&) VTK_DELETE_FUNCTION;
201 void operator=(const vtkSpline&) VTK_DELETE_FUNCTION;
202};
203
204#endif
205
a simple class to control print indentation
Definition: vtkIndent.h:40
abstract base class for most VTK objects
Definition: vtkObject.h:60
Defines a 1D piecewise function.
spline abstract class for interpolating splines
Definition: vtkSpline.h:63
vtkMTimeType GetMTime() override
Return the MTime also considering the Piecewise function.
void GetParametricRange(double tRange[2]) const
void SetParametricRange(double tRange[2])
Definition: vtkSpline.h:76
virtual double Evaluate(double t)=0
Interpolate the value of the spline at parametric location of t.
int GetNumberOfPoints()
Return the number of points inserted thus far.
void RemoveAllPoints()
Remove all points from the data.
void SetParametricRange(double tMin, double tMax)
Set/Get the parametric range.
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.
void AddPoint(double t, double x)
Add a pair of points to be fit with the spline.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
@ size
Definition: vtkX3D.h:253
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248