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 
35 #ifndef vtkTransform2D_h
36 #define vtkTransform2D_h
37 
38 #include "vtkCommonTransformsModule.h" // For export macro
39 #include "vtkObject.h"
40 
41 #include "vtkMatrix3x3.h" // Needed for inline methods
42 
43 class vtkPoints2D;
44 
45 class VTKCOMMONTRANSFORMS_EXPORT vtkTransform2D : public vtkObject
46 {
47  public:
48  static vtkTransform2D *New();
49  vtkTypeMacro(vtkTransform2D,vtkObject);
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
55  void Identity();
56 
60  void Inverse();
61 
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]); }
69 
74  void Rotate(double angle);
75 
80  void Scale(double x, double y);
81  void Scale(const double s[2]) { this->Scale(s[0], s[1]); }
82  void Scale(const float s[2]) { this->Scale(s[0], s[1]); }
83 
87  void SetMatrix(vtkMatrix3x3 *matrix) {
88  this->SetMatrix(matrix->GetData()); }
89  void SetMatrix(const double elements[9]);
90 
92 
95  vtkGetObjectMacro(Matrix, vtkMatrix3x3);
96  void GetMatrix(vtkMatrix3x3 *matrix);
98 
100 
105  void GetPosition(double pos[2]);
106  void GetPosition(float pos[2]) {
107  double temp[2];
108  this->GetPosition(temp);
109  pos[0] = static_cast<float>(temp[0]);
110  pos[1] = static_cast<float>(temp[1]); }
112 
114 
119  void GetScale(double pos[2]);
120  void GetScale(float pos[2]) {
121  double temp[2];
122  this->GetScale(temp);
123  pos[0] = static_cast<float>(temp[0]);
124  pos[1] = static_cast<float>(temp[1]); }
126 
131  void GetInverse(vtkMatrix3x3 *inverse);
132 
138  void GetTranspose(vtkMatrix3x3 *transpose);
139 
143  vtkMTimeType GetMTime() override;
144 
150  void TransformPoints(const float *inPts, float *outPts, int n);
151 
157  void TransformPoints(const double *inPts, double *outPts, int n);
158 
163  void TransformPoints(vtkPoints2D *inPts, vtkPoints2D *outPts);
164 
170  void InverseTransformPoints(const float *inPts, float *outPts, int n);
171 
177  void InverseTransformPoints(const double *inPts, double *outPts, int n);
178 
183  void InverseTransformPoints(vtkPoints2D *inPts, vtkPoints2D *outPts);
184 
186 
191  void MultiplyPoint(const float in[3], float out[3]) {
192  this->GetMatrix()->MultiplyPoint(in,out);};
193  void MultiplyPoint(const double in[3], double out[3]) {
194  this->GetMatrix()->MultiplyPoint(in,out);};
196 
197 protected:
198  vtkTransform2D ();
199  ~vtkTransform2D () override;
200 
201  void InternalDeepCopy(vtkTransform2D *t);
202 
205 
206 private:
207  vtkTransform2D (const vtkTransform2D&) = delete;
208  void operator=(const vtkTransform2D&) = delete;
209 };
210 
211 #endif
vtkPoints2D
represent and manipulate 2D points
Definition: vtkPoints2D.h:33
vtkTransform2D::GetScale
void GetScale(float pos[2])
Definition: vtkTransform2D.h:120
vtkMatrix3x3.h
vtkTransform2D
describes linear transformations via a 3x3 matrix
Definition: vtkTransform2D.h:45
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:53
vtkTransform2D::Scale
void Scale(const double s[2])
Definition: vtkTransform2D.h:81
vtkTransform2D::MultiplyPoint
void MultiplyPoint(const float in[3], float out[3])
Use this method only if you wish to compute the transformation in homogeneous (x,y,...
Definition: vtkTransform2D.h:191
vtkTransform2D::GetPosition
void GetPosition(float pos[2])
Definition: vtkTransform2D.h:106
vtkMatrix3x3
represent and manipulate 3x3 transformation matrices
Definition: vtkMatrix3x3.h:33
vtkMatrix3x3::GetData
double * GetData()
Return a pointer to the first element of the matrix (double[9]).
Definition: vtkMatrix3x3.h:155
vtkTransform2D::SetMatrix
void SetMatrix(vtkMatrix3x3 *matrix)
Set the current matrix directly.
Definition: vtkTransform2D.h:87
vtkTransform2D::Matrix
vtkMatrix3x3 * Matrix
Definition: vtkTransform2D.h:203
vtkObject::GetMTime
virtual vtkMTimeType GetMTime()
Return this object's modified time.
vtkTransform2D::MultiplyPoint
void MultiplyPoint(const double in[3], double out[3])
Definition: vtkTransform2D.h:193
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkObject.h
vtkTransform2D::Scale
void Scale(const float s[2])
Definition: vtkTransform2D.h:82
vtkTransform2D::Translate
void Translate(const float x[2])
Definition: vtkTransform2D.h:68
vtkTransform2D::Translate
void Translate(const double x[2])
Definition: vtkTransform2D.h:67
vtkTransform2D::InverseMatrix
vtkMatrix3x3 * InverseMatrix
Definition: vtkTransform2D.h:204
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302