00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00036 #ifndef __vtkTransform2D_h
00037 #define __vtkTransform2D_h
00038 
00039 #include "vtkObject.h"
00040 
00041 #include "vtkMatrix3x3.h" 
00042 
00043 class vtkPoints2D;
00044 
00045 class VTK_COMMON_EXPORT vtkTransform2D : public vtkObject
00046 {
00047  public:
00048   static vtkTransform2D *New();
00049   vtkTypeMacro(vtkTransform2D,vtkObject);
00050   void PrintSelf(ostream& os, vtkIndent indent);
00051 
00053   void Identity();
00054 
00056   void Inverse();
00057 
00059 
00061   void Translate(double x, double y);
00062   void Translate(const double x[2]) { this->Translate(x[0], x[1]); }
00063   void Translate(const float x[2]) { this->Translate(x[0], x[1]); }
00065 
00068   void Rotate(double angle);
00069 
00071 
00073   void Scale(double x, double y);
00074   void Scale(const double s[2]) { this->Scale(s[0], s[1]); }
00075   void Scale(const float s[2]) { this->Scale(s[0], s[1]); }
00077 
00079 
00080   void SetMatrix(vtkMatrix3x3 *matrix) {
00081     this->SetMatrix(matrix->GetData()); }
00082   void SetMatrix(const double elements[9]);
00084 
00086 
00087   vtkGetObjectMacro(Matrix, vtkMatrix3x3);
00088   void GetMatrix(vtkMatrix3x3 *matrix);
00090 
00092 
00095   void GetPosition(double pos[2]);
00096   void GetPosition(float pos[2]) {
00097     double temp[2];
00098     this->GetPosition(temp);
00099     pos[0] = static_cast<float>(temp[0]);
00100     pos[1] = static_cast<float>(temp[1]); }
00102 
00105   void GetInverse(vtkMatrix3x3 *inverse);
00106 
00110   void GetTranspose(vtkMatrix3x3 *transpose);
00111 
00113   unsigned long GetMTime();
00114 
00118   void TransformPoints(const float *inPts, float *outPts, int n);
00119 
00123   void TransformPoints(const double *inPts, double *outPts, int n);
00124 
00127   void TransformPoints(vtkPoints2D *inPts, vtkPoints2D *outPts);
00128 
00132   void InverseTransformPoints(const float *inPts, float *outPts, int n);
00133 
00137   void InverseTransformPoints(const double *inPts, double *outPts, int n);
00138 
00141   void InverseTransformPoints(vtkPoints2D *inPts, vtkPoints2D *outPts);
00142 
00144 
00147   void MultiplyPoint(const float in[3], float out[3]) {
00148     this->GetMatrix()->MultiplyPoint(in,out);};
00149   void MultiplyPoint(const double in[3], double out[3]) {
00150     this->GetMatrix()->MultiplyPoint(in,out);};
00152 
00153 protected:
00154   vtkTransform2D ();
00155   ~vtkTransform2D ();
00156 
00157   void InternalDeepCopy(vtkTransform2D *t);
00158 
00159   vtkMatrix3x3 *Matrix;
00160   vtkMatrix3x3 *InverseMatrix;
00161 
00162 private:
00163   vtkTransform2D (const vtkTransform2D&);  
00164   void operator=(const vtkTransform2D&);  
00165 };
00166 
00167 #endif