VTK
dox/Common/DataModel/vtkSpline.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkSpline.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00053 #ifndef __vtkSpline_h
00054 #define __vtkSpline_h
00055 
00056 #include "vtkCommonDataModelModule.h" // For export macro
00057 #include "vtkObject.h"
00058 
00059 class vtkPiecewiseFunction;
00060 
00061 class VTKCOMMONDATAMODEL_EXPORT vtkSpline : public vtkObject
00062 {
00063 public:
00064   vtkTypeMacro(vtkSpline,vtkObject);
00065   void PrintSelf(ostream& os, vtkIndent indent);
00066 
00068 
00072   void SetParametricRange(double tMin, double tMax);
00073   void SetParametricRange(double tRange[2])
00074     {this->SetParametricRange(tRange[0],tRange[1]);}
00075   void GetParametricRange(double tRange[2]) const;
00077 
00079 
00081   vtkSetMacro(ClampValue,int);
00082   vtkGetMacro(ClampValue,int);
00083   vtkBooleanMacro(ClampValue,int);
00085 
00087   virtual void Compute () = 0;
00088 
00090   virtual double Evaluate (double t) = 0;
00091 
00093   int GetNumberOfPoints();
00094 
00096   void AddPoint (double t, double x);
00097 
00099   void RemovePoint (double t);
00100 
00102   void RemoveAllPoints ();
00103 
00105 
00108   vtkSetMacro(Closed,int);
00109   vtkGetMacro(Closed,int);
00110   vtkBooleanMacro(Closed,int);
00112 
00114 
00122   vtkSetClampMacro(LeftConstraint,int,0,3);
00123   vtkGetMacro(LeftConstraint,int);
00124   vtkSetClampMacro(RightConstraint,int,0,3);
00125   vtkGetMacro(RightConstraint,int);
00127 
00129 
00131   vtkSetMacro(LeftValue,double);
00132   vtkGetMacro(LeftValue,double);
00133   vtkSetMacro(RightValue,double);
00134   vtkGetMacro(RightValue,double);
00136 
00138   unsigned long GetMTime();
00139 
00141   virtual void DeepCopy(vtkSpline *s);
00142 
00143 protected:
00144   vtkSpline();
00145   ~vtkSpline();
00146 
00147   unsigned long ComputeTime;
00148   int ClampValue;
00149   double *Intervals;
00150   double *Coefficients;
00151   int LeftConstraint;
00152   double LeftValue;
00153   int RightConstraint;
00154   double RightValue;
00155   vtkPiecewiseFunction *PiecewiseFunction;
00156   int Closed;
00157 
00158   // Explicitly specify the parametric range.
00159   double ParametricRange[2];
00160 
00161   // Helper methods
00162   double ComputeLeftDerivative();
00163   double ComputeRightDerivative();
00164   int FindIndex(int size, double t);
00165 
00166 private:
00167   vtkSpline(const vtkSpline&);  // Not implemented.
00168   void operator=(const vtkSpline&);  // Not implemented.
00169 };
00170 
00171 #endif
00172