VTK
vtkQuaternionInterpolator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkQuaternionInterpolator.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 =========================================================================*/
51 #ifndef __vtkQuaternionInterpolator_h
52 #define __vtkQuaternionInterpolator_h
53 
54 #include "vtkCommonMathModule.h" // For export macro
55 #include "vtkObject.h"
56 
57 struct vtkQuaternion;
58 class vtkQuaternionList;
59 
60 
61 class VTKCOMMONMATH_EXPORT vtkQuaternionInterpolator : public vtkObject
62 {
63 public:
65  void PrintSelf(ostream& os, vtkIndent indent);
66 
69 
72  int GetNumberOfQuaternions();
73 
75 
79  double GetMinimumT();
80  double GetMaximumT();
82 
85  void Initialize();
86 
91  void AddQuaternion(double t, double q[4]);
92 
95  void RemoveQuaternion(double t);
96 
100  void InterpolateQuaternion(double t, double q[4]);
101 
102 //BTX
104 
105  enum {INTERPOLATION_TYPE_LINEAR=0,
106  INTERPOLATION_TYPE_SPLINE
107  };
108 //ETX
110 
112 
117  vtkSetClampMacro(InterpolationType,int,INTERPOLATION_TYPE_LINEAR,
118  INTERPOLATION_TYPE_SPLINE);
119  vtkGetMacro(InterpolationType,int);
120  void SetInterpolationTypeToLinear()
121  {this->SetInterpolationType(INTERPOLATION_TYPE_LINEAR);}
122  void SetInterpolationTypeToSpline()
123  {this->SetInterpolationType(INTERPOLATION_TYPE_SPLINE);}
125 
126 protected:
128  virtual ~vtkQuaternionInterpolator();
129 
130  // Specify the type of interpolation to use
132 
133  // Internal variables for interpolation functions
134  vtkQuaternionList *QuaternionList; //used for linear quaternion interpolation
135 
136  // Internal method for spherical, linear interpolation
137  void Slerp(double t, double q0[4], double q1[4], double q[4]);
138 
139  // Internal methods supporting spline interpolation
140  static void InnerPoint(double q0[4], double q1[4], double q2[4], double q[4]);
141 
142 private:
143  vtkQuaternionInterpolator(const vtkQuaternionInterpolator&); // Not implemented.
144  void operator=(const vtkQuaternionInterpolator&); // Not implemented.
145 
146 };
147 
148 #endif