VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Common/Transforms/vtkTransform2D.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkTransform2D.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 =========================================================================*/
00015 
00036 #ifndef vtkTransform2D_h
00037 #define vtkTransform2D_h
00038 
00039 #include "vtkCommonTransformsModule.h" // For export macro
00040 #include "vtkObject.h"
00041 
00042 #include "vtkMatrix3x3.h" // Needed for inline methods
00043 
00044 class vtkPoints2D;
00045 
00046 class VTKCOMMONTRANSFORMS_EXPORT vtkTransform2D : public vtkObject
00047 {
00048  public:
00049   static vtkTransform2D *New();
00050   vtkTypeMacro(vtkTransform2D,vtkObject);
00051   void PrintSelf(ostream& os, vtkIndent indent);
00052 
00054   void Identity();
00055 
00057   void Inverse();
00058 
00060 
00062   void Translate(double x, double y);
00063   void Translate(const double x[2]) { this->Translate(x[0], x[1]); }
00064   void Translate(const float x[2]) { this->Translate(x[0], x[1]); }
00066 
00069   void Rotate(double angle);
00070 
00072 
00074   void Scale(double x, double y);
00075   void Scale(const double s[2]) { this->Scale(s[0], s[1]); }
00076   void Scale(const float s[2]) { this->Scale(s[0], s[1]); }
00078 
00080 
00081   void SetMatrix(vtkMatrix3x3 *matrix) {
00082     this->SetMatrix(matrix->GetData()); }
00083   void SetMatrix(const double elements[9]);
00085 
00087 
00088   vtkGetObjectMacro(Matrix, vtkMatrix3x3);
00089   void GetMatrix(vtkMatrix3x3 *matrix);
00091 
00093 
00096   void GetPosition(double pos[2]);
00097   void GetPosition(float pos[2]) {
00098     double temp[2];
00099     this->GetPosition(temp);
00100     pos[0] = static_cast<float>(temp[0]);
00101     pos[1] = static_cast<float>(temp[1]); }
00103 
00105 
00108   void GetScale(double pos[2]);
00109   void GetScale(float pos[2]) {
00110     double temp[2];
00111     this->GetScale(temp);
00112     pos[0] = static_cast<float>(temp[0]);
00113     pos[1] = static_cast<float>(temp[1]); }
00115 
00118   void GetInverse(vtkMatrix3x3 *inverse);
00119 
00123   void GetTranspose(vtkMatrix3x3 *transpose);
00124 
00126   unsigned long GetMTime();
00127 
00131   void TransformPoints(const float *inPts, float *outPts, int n);
00132 
00136   void TransformPoints(const double *inPts, double *outPts, int n);
00137 
00140   void TransformPoints(vtkPoints2D *inPts, vtkPoints2D *outPts);
00141 
00145   void InverseTransformPoints(const float *inPts, float *outPts, int n);
00146 
00150   void InverseTransformPoints(const double *inPts, double *outPts, int n);
00151 
00154   void InverseTransformPoints(vtkPoints2D *inPts, vtkPoints2D *outPts);
00155 
00157 
00160   void MultiplyPoint(const float in[3], float out[3]) {
00161     this->GetMatrix()->MultiplyPoint(in,out);};
00162   void MultiplyPoint(const double in[3], double out[3]) {
00163     this->GetMatrix()->MultiplyPoint(in,out);};
00165 
00166 protected:
00167   vtkTransform2D ();
00168   ~vtkTransform2D ();
00169 
00170   void InternalDeepCopy(vtkTransform2D *t);
00171 
00172   vtkMatrix3x3 *Matrix;
00173   vtkMatrix3x3 *InverseMatrix;
00174 
00175 private:
00176   vtkTransform2D (const vtkTransform2D&);  // Not implemented
00177   void operator=(const vtkTransform2D&);  // Not implemented
00178 };
00179 
00180 #endif