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 "vtkObject.h" 00056 00057 00058 class vtkTransform; 00059 class vtkMatrix4x4; 00060 class vtkProp3D; 00061 class vtkTupleInterpolator; 00062 class vtkQuaternionInterpolator; 00063 class vtkTransformList; 00064 00065 00066 class VTK_RENDERING_EXPORT vtkTransformInterpolator : public vtkObject 00067 { 00068 public: 00069 vtkTypeMacro(vtkTransformInterpolator, vtkObject); 00070 void PrintSelf(ostream& os, vtkIndent indent); 00071 00073 static vtkTransformInterpolator* New(); 00074 00076 int GetNumberOfTransforms(); 00077 00079 00082 double GetMinimumT(); 00083 double GetMaximumT(); 00085 00087 void Initialize(); 00088 00090 00096 void AddTransform(double t, vtkTransform *xform); 00097 void AddTransform(double t, vtkMatrix4x4 *matrix); 00098 void AddTransform(double t, vtkProp3D *prop3D); 00100 00103 void RemoveTransform(double t); 00104 00108 void InterpolateTransform(double t, vtkTransform *xform); 00109 00110 //BTX 00112 00113 enum {INTERPOLATION_TYPE_LINEAR=0, 00114 INTERPOLATION_TYPE_SPLINE, 00115 INTERPOLATION_TYPE_MANUAL 00116 }; 00117 //ETX 00119 00121 00128 vtkSetClampMacro(InterpolationType,int, INTERPOLATION_TYPE_LINEAR, 00129 INTERPOLATION_TYPE_MANUAL); 00130 vtkGetMacro(InterpolationType,int); 00131 void SetInterpolationTypeToLinear() 00132 {this->SetInterpolationType(INTERPOLATION_TYPE_LINEAR);} 00133 void SetInterpolationTypeToSpline() 00134 {this->SetInterpolationType(INTERPOLATION_TYPE_SPLINE);} 00135 void SetInterpolationTypeToManual() 00136 {this->SetInterpolationType(INTERPOLATION_TYPE_MANUAL);} 00138 00140 00144 virtual void SetPositionInterpolator(vtkTupleInterpolator*); 00145 vtkGetObjectMacro(PositionInterpolator,vtkTupleInterpolator); 00147 00149 00153 virtual void SetScaleInterpolator(vtkTupleInterpolator*); 00154 vtkGetObjectMacro(ScaleInterpolator,vtkTupleInterpolator); 00156 00158 00162 virtual void SetRotationInterpolator(vtkQuaternionInterpolator*); 00163 vtkGetObjectMacro(RotationInterpolator,vtkQuaternionInterpolator); 00165 00168 unsigned long GetMTime(); 00169 00170 protected: 00171 vtkTransformInterpolator(); 00172 virtual ~vtkTransformInterpolator(); 00173 00174 // Control the interpolation type 00175 int InterpolationType; 00176 00177 // Interpolators 00178 vtkTupleInterpolator *PositionInterpolator; 00179 vtkTupleInterpolator *ScaleInterpolator; 00180 vtkQuaternionInterpolator *RotationInterpolator; 00181 00182 // Initialize the interpolating splines 00183 int Initialized; 00184 vtkTimeStamp InitializeTime; 00185 void InitializeInterpolation(); 00186 00187 // Keep track of inserted data 00188 vtkTransformList *TransformList; 00189 00190 private: 00191 vtkTransformInterpolator(const vtkTransformInterpolator&); // Not implemented. 00192 void operator=(const vtkTransformInterpolator&); // Not implemented. 00193 00194 }; 00195 00196 #endif