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 
36 #ifndef vtkTransform2D_h
37 #define vtkTransform2D_h
38 
39 #include "vtkCommonTransformsModule.h" // For export macro
40 #include "vtkObject.h"
41 
42 #include "vtkMatrix3x3.h" // Needed for inline methods
43 
44 class vtkPoints2D;
45 
47 {
48  public:
49  static vtkTransform2D *New();
50  vtkTypeMacro(vtkTransform2D,vtkObject);
51  void PrintSelf(ostream& os, vtkIndent indent);
52 
54  void Identity();
55 
57  void Inverse();
58 
60 
62  void Translate(double x, double y);
63  void Translate(const double x[2]) { this->Translate(x[0], x[1]); }
64  void Translate(const float x[2]) { this->Translate(x[0], x[1]); }
66 
69  void Rotate(double angle);
70 
72 
74  void Scale(double x, double y);
75  void Scale(const double s[2]) { this->Scale(s[0], s[1]); }
76  void Scale(const float s[2]) { this->Scale(s[0], s[1]); }
78 
80 
81  void SetMatrix(vtkMatrix3x3 *matrix) {
82  this->SetMatrix(matrix->GetData()); }
83  void SetMatrix(const double elements[9]);
85 
87 
88  vtkGetObjectMacro(Matrix, vtkMatrix3x3);
89  void GetMatrix(vtkMatrix3x3 *matrix);
91 
93 
96  void GetPosition(double pos[2]);
97  void GetPosition(float pos[2]) {
98  double temp[2];
99  this->GetPosition(temp);
100  pos[0] = static_cast<float>(temp[0]);
101  pos[1] = static_cast<float>(temp[1]); }
103 
105 
108  void GetScale(double pos[2]);
109  void GetScale(float pos[2]) {
110  double temp[2];
111  this->GetScale(temp);
112  pos[0] = static_cast<float>(temp[0]);
113  pos[1] = static_cast<float>(temp[1]); }
115 
118  void GetInverse(vtkMatrix3x3 *inverse);
119 
123  void GetTranspose(vtkMatrix3x3 *transpose);
124 
126  unsigned long GetMTime();
127 
131  void TransformPoints(const float *inPts, float *outPts, int n);
132 
136  void TransformPoints(const double *inPts, double *outPts, int n);
137 
140  void TransformPoints(vtkPoints2D *inPts, vtkPoints2D *outPts);
141 
145  void InverseTransformPoints(const float *inPts, float *outPts, int n);
146 
150  void InverseTransformPoints(const double *inPts, double *outPts, int n);
151 
154  void InverseTransformPoints(vtkPoints2D *inPts, vtkPoints2D *outPts);
155 
157 
160  void MultiplyPoint(const float in[3], float out[3]) {
161  this->GetMatrix()->MultiplyPoint(in,out);};
162  void MultiplyPoint(const double in[3], double out[3]) {
163  this->GetMatrix()->MultiplyPoint(in,out);};
165 
166 protected:
167  vtkTransform2D ();
168  ~vtkTransform2D ();
169 
170  void InternalDeepCopy(vtkTransform2D *t);
171 
174 
175 private:
176  vtkTransform2D (const vtkTransform2D&); // Not implemented
177  void operator=(const vtkTransform2D&); // Not implemented
178 };
179 
180 #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])