VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkQuaternionInterpolator.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 =========================================================================*/ 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 //BTX 00103 00104 enum {INTERPOLATION_TYPE_LINEAR=0, 00105 INTERPOLATION_TYPE_SPLINE 00106 }; 00107 //ETX 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 // Specify the type of interpolation to use 00130 int InterpolationType; 00131 00132 // Internal variables for interpolation functions 00133 vtkQuaternionList *QuaternionList; //used for linear quaternion interpolation 00134 00135 // Internal method for spherical, linear interpolation 00136 void Slerp(double t, double q0[4], double q1[4], double q[4]); 00137 00138 // Internal methods supporting spline interpolation 00139 static void InnerPoint(double q0[4], double q1[4], double q2[4], double q[4]); 00140 00141 private: 00142 vtkQuaternionInterpolator(const vtkQuaternionInterpolator&); // Not implemented. 00143 void operator=(const vtkQuaternionInterpolator&); // Not implemented. 00144 00145 }; 00146 00147 #endif