00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00059 #include "vtkAbstractTransform.h"
00060 
00061 #ifndef __vtkGeneralTransform_h
00062 #define __vtkGeneralTransform_h
00063 
00064 class VTK_EXPORT vtkGeneralTransform : public vtkAbstractTransform
00065 {
00066 public:
00067   static vtkGeneralTransform *New();
00068 
00069   vtkTypeMacro(vtkGeneralTransform,vtkAbstractTransform);
00070   void PrintSelf(ostream& os, vtkIndent indent);
00071   
00075   void Identity() { this->Concatenation->Identity(); this->Modified(); };
00076 
00080   void Inverse() { this->Concatenation->Inverse(); this->Modified(); };
00081 
00084   void Translate(double x, double y, double z) {
00085     this->Concatenation->Translate(x,y,z); };
00086   void Translate(const double x[3]) { this->Translate(x[0], x[1], x[2]); };
00087   void Translate(const float x[3]) { this->Translate(x[0], x[1], x[2]); };
00088 
00093   void RotateWXYZ(double angle, double x, double y, double z) {
00094     this->Concatenation->Rotate(angle,x,y,z); };
00095   void RotateWXYZ(double angle, const double axis[3]) {
00096     this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
00097   void RotateWXYZ(double angle, const float axis[3]) {
00098     this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
00099 
00103   void RotateX(double angle) { this->RotateWXYZ(angle, 1, 0, 0); };
00104   void RotateY(double angle) { this->RotateWXYZ(angle, 0, 1, 0); };
00105   void RotateZ(double angle) { this->RotateWXYZ(angle, 0, 0, 1); };
00106 
00110   void Scale(double x, double y, double z) {
00111     this->Concatenation->Scale(x,y,z); };
00112   void Scale(const double s[3]) { this->Scale(s[0], s[1], s[2]); };
00113   void Scale(const float s[3]) { this->Scale(s[0], s[1], s[2]); };
00114 
00117   void Concatenate(vtkMatrix4x4 *matrix) { 
00118     this->Concatenate(*matrix->Element); };
00119   void Concatenate(const double elements[16]) {
00120     this->Concatenation->Concatenate(elements); };
00121 
00127   void Concatenate(vtkAbstractTransform *transform);
00128 
00134   void PreMultiply() { 
00135     if (this->Concatenation->GetPreMultiplyFlag()) { return; }
00136     this->Concatenation->SetPreMultiplyFlag(1); this->Modified(); };
00137 
00143   void PostMultiply()  { 
00144     if (!this->Concatenation->GetPreMultiplyFlag()) { return; }
00145     this->Concatenation->SetPreMultiplyFlag(0); this->Modified(); };
00146 
00148   void Push() { if (this->Stack == NULL) { 
00149                     this->Stack = vtkTransformConcatenationStack::New(); }
00150                 this->Stack->Push(&this->Concatenation); 
00151                 this->Modified(); };
00152 
00155   void Pop() { if (this->Stack == NULL) { return; }
00156                this->Stack->Pop(&this->Concatenation);
00157                this->Modified(); };
00158 
00163   void SetInput(vtkAbstractTransform *input);
00164   vtkAbstractTransform *GetInput() { return this->Input; };
00165 
00168   void InternalTransformPoint(const float in[3], float out[3]);
00169   void InternalTransformPoint(const double in[3], double out[3]);
00170 
00173   void InternalTransformDerivative(const float in[3], float out[3],
00174                float derivative[3][3]);
00175   void InternalTransformDerivative(const double in[3], double out[3],
00176                double derivative[3][3]);
00177 
00184   int CircuitCheck(vtkAbstractTransform *transform);
00185 
00187   vtkAbstractTransform *MakeTransform();
00188 
00190   unsigned long GetMTime();
00191 
00192 protected:
00193   vtkGeneralTransform();
00194   ~vtkGeneralTransform();
00195   vtkGeneralTransform(const vtkGeneralTransform&) {};
00196   void operator=(const vtkGeneralTransform&) {};
00197 
00198   void InternalDeepCopy(vtkAbstractTransform *t);
00199   void InternalUpdate();
00200 
00201   vtkAbstractTransform *Input;
00202   vtkTransformConcatenation *Concatenation;
00203   vtkTransformConcatenationStack *Stack;
00204 };
00205 
00206 
00207 #endif
00208 
00209 
00210 
00211 
00212