VTK
|
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 "vtkObject.h" 00057 00058 class vtkPiecewiseFunction; 00059 00060 class VTK_FILTERING_EXPORT vtkSpline : public vtkObject 00061 { 00062 public: 00063 vtkTypeMacro(vtkSpline,vtkObject); 00064 void PrintSelf(ostream& os, vtkIndent indent); 00065 00067 00071 void SetParametricRange(double tMin, double tMax); 00072 void SetParametricRange(double tRange[2]) 00073 {this->SetParametricRange(tRange[0],tRange[1]);} 00074 void GetParametricRange(double tRange[2]) const; 00076 00078 00080 vtkSetMacro(ClampValue,int); 00081 vtkGetMacro(ClampValue,int); 00082 vtkBooleanMacro(ClampValue,int); 00084 00086 virtual void Compute () = 0; 00087 00089 virtual double Evaluate (double t) = 0; 00090 00092 int GetNumberOfPoints(); 00093 00095 void AddPoint (double t, double x); 00096 00098 void RemovePoint (double t); 00099 00101 void RemoveAllPoints (); 00102 00104 00107 vtkSetMacro(Closed,int); 00108 vtkGetMacro(Closed,int); 00109 vtkBooleanMacro(Closed,int); 00111 00113 00121 vtkSetClampMacro(LeftConstraint,int,0,3); 00122 vtkGetMacro(LeftConstraint,int); 00123 vtkSetClampMacro(RightConstraint,int,0,3); 00124 vtkGetMacro(RightConstraint,int); 00126 00128 00130 vtkSetMacro(LeftValue,double); 00131 vtkGetMacro(LeftValue,double); 00132 vtkSetMacro(RightValue,double); 00133 vtkGetMacro(RightValue,double); 00135 00137 unsigned long GetMTime(); 00138 00140 virtual void DeepCopy(vtkSpline *s); 00141 00142 protected: 00143 vtkSpline(); 00144 ~vtkSpline(); 00145 00146 unsigned long ComputeTime; 00147 int ClampValue; 00148 double *Intervals; 00149 double *Coefficients; 00150 int LeftConstraint; 00151 double LeftValue; 00152 int RightConstraint; 00153 double RightValue; 00154 vtkPiecewiseFunction *PiecewiseFunction; 00155 int Closed; 00156 00157 // Explicitly specify the parametric range. 00158 double ParametricRange[2]; 00159 00160 // Helper methods 00161 double ComputeLeftDerivative(); 00162 double ComputeRightDerivative(); 00163 int FindIndex(int size, double t); 00164 00165 private: 00166 vtkSpline(const vtkSpline&); // Not implemented. 00167 void operator=(const vtkSpline&); // Not implemented. 00168 }; 00169 00170 #endif 00171