00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00051 #ifndef __vtkQuaternionInterpolator_h
00052 #define __vtkQuaternionInterpolator_h
00053 
00054 #include "vtkObject.h"
00055 
00056 struct vtkQuaternion;
00057 class vtkQuaternionList;
00058 
00059 
00060 class VTK_RENDERING_EXPORT vtkQuaternionInterpolator : public vtkObject
00061 {
00062 public:
00063   vtkTypeMacro(vtkQuaternionInterpolator, vtkObject);
00064   void PrintSelf(ostream& os, vtkIndent indent);
00065 
00067   static vtkQuaternionInterpolator* New();
00068 
00071   int GetNumberOfQuaternions();
00072 
00074 
00078   double GetMinimumT();
00079   double GetMaximumT();
00081 
00084   void Initialize();
00085   
00090   void AddQuaternion(double t, double q[4]);
00091 
00094   void RemoveQuaternion(double t);
00095 
00099   void InterpolateQuaternion(double t, double q[4]);
00100 
00101 
00103 
00104   enum {INTERPOLATION_TYPE_LINEAR=0,
00105         INTERPOLATION_TYPE_SPLINE
00106   };
00107 
00109 
00111 
00116   vtkSetClampMacro(InterpolationType,int,INTERPOLATION_TYPE_LINEAR,
00117                    INTERPOLATION_TYPE_SPLINE);
00118   vtkGetMacro(InterpolationType,int);
00119   void SetInterpolationTypeToLinear()
00120     {this->SetInterpolationType(INTERPOLATION_TYPE_LINEAR);}
00121   void SetInterpolationTypeToSpline()
00122     {this->SetInterpolationType(INTERPOLATION_TYPE_SPLINE);}
00124 
00125 protected:
00126   vtkQuaternionInterpolator();
00127   virtual ~vtkQuaternionInterpolator();
00128 
00129   
00130   int InterpolationType;
00131 
00132   
00133   vtkQuaternionList *QuaternionList; 
00134   
00135   
00136   void Slerp(double t, double q0[4], double q1[4], double q[4]);
00137 
00138   
00139   static void InnerPoint(double q0[4], double q1[4], double q2[4], double q[4]);
00140 
00141 private:
00142   vtkQuaternionInterpolator(const vtkQuaternionInterpolator&);  
00143   void operator=(const vtkQuaternionInterpolator&);  
00144 
00145 };
00146 
00147 #endif