VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkTransformInterpolator.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 =========================================================================*/ 00052 #ifndef vtkTransformInterpolator_h 00053 #define vtkTransformInterpolator_h 00054 00055 #include "vtkRenderingCoreModule.h" // For export macro 00056 #include "vtkObject.h" 00057 00058 00059 class vtkTransform; 00060 class vtkMatrix4x4; 00061 class vtkProp3D; 00062 class vtkTupleInterpolator; 00063 class vtkQuaternionInterpolator; 00064 class vtkTransformList; 00065 00066 00067 class VTKRENDERINGCORE_EXPORT vtkTransformInterpolator : public vtkObject 00068 { 00069 public: 00070 vtkTypeMacro(vtkTransformInterpolator, vtkObject); 00071 void PrintSelf(ostream& os, vtkIndent indent); 00072 00074 static vtkTransformInterpolator* New(); 00075 00077 int GetNumberOfTransforms(); 00078 00080 00083 double GetMinimumT(); 00084 double GetMaximumT(); 00086 00088 void Initialize(); 00089 00091 00097 void AddTransform(double t, vtkTransform *xform); 00098 void AddTransform(double t, vtkMatrix4x4 *matrix); 00099 void AddTransform(double t, vtkProp3D *prop3D); 00101 00104 void RemoveTransform(double t); 00105 00109 void InterpolateTransform(double t, vtkTransform *xform); 00110 00111 //BTX 00113 00114 enum {INTERPOLATION_TYPE_LINEAR=0, 00115 INTERPOLATION_TYPE_SPLINE, 00116 INTERPOLATION_TYPE_MANUAL 00117 }; 00118 //ETX 00120 00122 00129 vtkSetClampMacro(InterpolationType,int, INTERPOLATION_TYPE_LINEAR, 00130 INTERPOLATION_TYPE_MANUAL); 00131 vtkGetMacro(InterpolationType,int); 00132 void SetInterpolationTypeToLinear() 00133 {this->SetInterpolationType(INTERPOLATION_TYPE_LINEAR);} 00134 void SetInterpolationTypeToSpline() 00135 {this->SetInterpolationType(INTERPOLATION_TYPE_SPLINE);} 00136 void SetInterpolationTypeToManual() 00137 {this->SetInterpolationType(INTERPOLATION_TYPE_MANUAL);} 00139 00141 00145 virtual void SetPositionInterpolator(vtkTupleInterpolator*); 00146 vtkGetObjectMacro(PositionInterpolator,vtkTupleInterpolator); 00148 00150 00154 virtual void SetScaleInterpolator(vtkTupleInterpolator*); 00155 vtkGetObjectMacro(ScaleInterpolator,vtkTupleInterpolator); 00157 00159 00163 virtual void SetRotationInterpolator(vtkQuaternionInterpolator*); 00164 vtkGetObjectMacro(RotationInterpolator,vtkQuaternionInterpolator); 00166 00169 unsigned long GetMTime(); 00170 00171 protected: 00172 vtkTransformInterpolator(); 00173 virtual ~vtkTransformInterpolator(); 00174 00175 // Control the interpolation type 00176 int InterpolationType; 00177 00178 // Interpolators 00179 vtkTupleInterpolator *PositionInterpolator; 00180 vtkTupleInterpolator *ScaleInterpolator; 00181 vtkQuaternionInterpolator *RotationInterpolator; 00182 00183 // Initialize the interpolating splines 00184 int Initialized; 00185 vtkTimeStamp InitializeTime; 00186 void InitializeInterpolation(); 00187 00188 // Keep track of inserted data 00189 vtkTransformList *TransformList; 00190 00191 private: 00192 vtkTransformInterpolator(const vtkTransformInterpolator&); // Not implemented. 00193 void operator=(const vtkTransformInterpolator&); // Not implemented. 00194 00195 }; 00196 00197 #endif