VTK
vtkTransform2D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTransform2D.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
40 #ifndef vtkTransform2D_h
41 #define vtkTransform2D_h
42 
43 #include "vtkCommonTransformsModule.h" // For export macro
44 #include "vtkObject.h"
45 
46 #include "vtkMatrix3x3.h" // Needed for inline methods
47 
48 class vtkPoints2D;
49 
51 {
52  public:
53  static vtkTransform2D *New();
54  vtkTypeMacro(vtkTransform2D,vtkObject);
55  void PrintSelf(ostream& os, vtkIndent indent);
56 
58  void Identity();
59 
61  void Inverse();
62 
64 
66  void Translate(double x, double y);
67  void Translate(const double x[2]) { this->Translate(x[0], x[1]); }
68  void Translate(const float x[2]) { this->Translate(x[0], x[1]); }
70 
73  void Rotate(double angle);
74 
76 
78  void Scale(double x, double y);
79  void Scale(const double s[2]) { this->Scale(s[0], s[1]); }
80  void Scale(const float s[2]) { this->Scale(s[0], s[1]); }
82 
84 
85  void SetMatrix(vtkMatrix3x3 *matrix) {
86  this->SetMatrix(matrix->GetData()); }
87  void SetMatrix(const double elements[9]);
89 
91 
92  vtkGetObjectMacro(Matrix, vtkMatrix3x3);
93  void GetMatrix(vtkMatrix3x3 *matrix);
95 
97 
100  void GetPosition(double pos[2]);
101  void GetPosition(float pos[2]) {
102  double temp[2];
103  this->GetPosition(temp);
104  pos[0] = static_cast<float>(temp[0]);
105  pos[1] = static_cast<float>(temp[1]); }
107 
109 
112  void GetScale(double pos[2]);
113  void GetScale(float pos[2]) {
114  double temp[2];
115  this->GetScale(temp);
116  pos[0] = static_cast<float>(temp[0]);
117  pos[1] = static_cast<float>(temp[1]); }
119 
122  void GetInverse(vtkMatrix3x3 *inverse);
123 
127  void GetTranspose(vtkMatrix3x3 *transpose);
128 
130  unsigned long GetMTime();
131 
135  void TransformPoints(const float *inPts, float *outPts, int n);
136 
140  void TransformPoints(const double *inPts, double *outPts, int n);
141 
144  void TransformPoints(vtkPoints2D *inPts, vtkPoints2D *outPts);
145 
149  void InverseTransformPoints(const float *inPts, float *outPts, int n);
150 
154  void InverseTransformPoints(const double *inPts, double *outPts, int n);
155 
158  void InverseTransformPoints(vtkPoints2D *inPts, vtkPoints2D *outPts);
159 
161 
164  void MultiplyPoint(const float in[3], float out[3]) {
165  this->GetMatrix()->MultiplyPoint(in,out);};
166  void MultiplyPoint(const double in[3], double out[3]) {
167  this->GetMatrix()->MultiplyPoint(in,out);};
169 
170 protected:
171  vtkTransform2D ();
172  ~vtkTransform2D ();
173 
174  void InternalDeepCopy(vtkTransform2D *t);
175 
178 
179 private:
180  vtkTransform2D (const vtkTransform2D&); // Not implemented
181  void operator=(const vtkTransform2D&); // Not implemented
182 };
183 
184 #endif
vtkMatrix3x3 * InverseMatrix
abstract base class for most VTK objects
Definition: vtkObject.h:61
void GetScale(float pos[2])
void Translate(const double x[2])
virtual void PrintSelf(ostream &os, vtkIndent indent)
virtual unsigned long GetMTime()
#define VTKCOMMONTRANSFORMS_EXPORT
a simple class to control print indentation
Definition: vtkIndent.h:38
represent and manipulate 2D points
Definition: vtkPoints2D.h:35
describes linear transformations via a 3x3 matrix
double * GetData()
Definition: vtkMatrix3x3.h:193
void MultiplyPoint(const double in[3], double out[3])
vtkMatrix3x3 * Matrix
void GetPosition(float pos[2])
void Translate(const float x[2])
void SetMatrix(vtkMatrix3x3 *matrix)
static vtkObject * New()
represent and manipulate 3x3 transformation matrices
Definition: vtkMatrix3x3.h:35
void Scale(const double s[2])
void MultiplyPoint(const float in[3], float out[3])
void Scale(const float s[2])