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 "vtkObject.h"
55 
56 struct vtkQuaternion;
57 class vtkQuaternionList;
58 
59 
61 {
62 public:
64  void PrintSelf(ostream& os, vtkIndent indent);
65 
68 
71  int GetNumberOfQuaternions();
72 
74 
78  double GetMinimumT();
79  double GetMaximumT();
81 
84  void Initialize();
85 
90  void AddQuaternion(double t, double q[4]);
91 
94  void RemoveQuaternion(double t);
95 
99  void InterpolateQuaternion(double t, double q[4]);
100 
101 //BTX
103 
104  enum {INTERPOLATION_TYPE_LINEAR=0,
105  INTERPOLATION_TYPE_SPLINE
106  };
107 //ETX
109 
111 
116  vtkSetClampMacro(InterpolationType,int,INTERPOLATION_TYPE_LINEAR,
117  INTERPOLATION_TYPE_SPLINE);
118  vtkGetMacro(InterpolationType,int);
120  {this->SetInterpolationType(INTERPOLATION_TYPE_LINEAR);}
122  {this->SetInterpolationType(INTERPOLATION_TYPE_SPLINE);}
124 
125 protected:
127  virtual ~vtkQuaternionInterpolator();
128 
129  // Specify the type of interpolation to use
131 
132  // Internal variables for interpolation functions
133  vtkQuaternionList *QuaternionList; //used for linear quaternion interpolation
134 
135  // Internal method for spherical, linear interpolation
136  void Slerp(double t, double q0[4], double q1[4], double q[4]);
137 
138  // Internal methods supporting spline interpolation
139  static void InnerPoint(double q0[4], double q1[4], double q2[4], double q[4]);
140 
141 private:
142  vtkQuaternionInterpolator(const vtkQuaternionInterpolator&); // Not implemented.
143  void operator=(const vtkQuaternionInterpolator&); // Not implemented.
144 
145 };
146 
147 #endif