VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vtkGeneralTransform.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGeneralTransform.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 =========================================================================*/
31 #ifndef __vtkGeneralTransform_h
32 #define __vtkGeneralTransform_h
33 
34 #include "vtkCommonTransformsModule.h" // For export macro
35 #include "vtkAbstractTransform.h"
36 
37 #include "vtkMatrix4x4.h" // Needed for inline methods
38 
39 class VTKCOMMONTRANSFORMS_EXPORT vtkGeneralTransform : public vtkAbstractTransform
40 {
41 public:
42  static vtkGeneralTransform *New();
43 
45  void PrintSelf(ostream& os, vtkIndent indent);
46 
50  void Identity() { this->Concatenation->Identity(); this->Modified(); };
51 
55  void Inverse() { this->Concatenation->Inverse(); this->Modified(); };
56 
58 
60  void Translate(double x, double y, double z) {
61  this->Concatenation->Translate(x,y,z); };
62  void Translate(const double x[3]) { this->Translate(x[0], x[1], x[2]); };
63  void Translate(const float x[3]) { this->Translate(x[0], x[1], x[2]); };
65 
67 
71  void RotateWXYZ(double angle, double x, double y, double z) {
72  this->Concatenation->Rotate(angle,x,y,z); };
73  void RotateWXYZ(double angle, const double axis[3]) {
74  this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
75  void RotateWXYZ(double angle, const float axis[3]) {
76  this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
78 
80 
83  void RotateX(double angle) { this->RotateWXYZ(angle, 1, 0, 0); };
84  void RotateY(double angle) { this->RotateWXYZ(angle, 0, 1, 0); };
85  void RotateZ(double angle) { this->RotateWXYZ(angle, 0, 0, 1); };
87 
89 
92  void Scale(double x, double y, double z) {
93  this->Concatenation->Scale(x,y,z); };
94  void Scale(const double s[3]) { this->Scale(s[0], s[1], s[2]); };
95  void Scale(const float s[3]) { this->Scale(s[0], s[1], s[2]); };
97 
99 
101  void Concatenate(vtkMatrix4x4 *matrix) {
102  this->Concatenate(*matrix->Element); };
103  void Concatenate(const double elements[16]) {
104  this->Concatenation->Concatenate(elements); };
106 
112  void Concatenate(vtkAbstractTransform *transform);
113 
115 
120  void PreMultiply() {
121  if (this->Concatenation->GetPreMultiplyFlag()) { return; }
122  this->Concatenation->SetPreMultiplyFlag(1); this->Modified(); };
124 
126 
131  void PostMultiply() {
132  if (!this->Concatenation->GetPreMultiplyFlag()) { return; }
133  this->Concatenation->SetPreMultiplyFlag(0); this->Modified(); };
135 
137 
140  return this->Concatenation->GetNumberOfTransforms() +
141  (this->Input == NULL ? 0 : 1); };
143 
145 
151  if (this->Input == NULL) {
152  return this->Concatenation->GetTransform(i); }
153  else if (i < this->Concatenation->GetNumberOfPreTransforms()) {
154  return this->Concatenation->GetTransform(i); }
155  else if (i > this->Concatenation->GetNumberOfPreTransforms()) {
156  return this->Concatenation->GetTransform(i-1); }
157  else if (this->GetInverseFlag()) {
158  return this->Input->GetInverse(); }
159  else {
160  return this->Input; } };
162 
164 
170  void SetInput(vtkAbstractTransform *input);
171  vtkAbstractTransform *GetInput() { return this->Input; };
173 
175 
180  return this->Concatenation->GetInverseFlag(); };
182 
184 
185  void Push() { if (this->Stack == NULL) {
186  this->Stack = vtkTransformConcatenationStack::New(); }
187  this->Stack->Push(&this->Concatenation);
188  this->Modified(); };
190 
192 
194  void Pop() { if (this->Stack == NULL) { return; }
195  this->Stack->Pop(&this->Concatenation);
196  this->Modified(); };
198 
200 
202  void InternalTransformPoint(const float in[3], float out[3]);
203  void InternalTransformPoint(const double in[3], double out[3]);
205 
207 
209  void InternalTransformDerivative(const float in[3], float out[3],
210  float derivative[3][3]);
211  void InternalTransformDerivative(const double in[3], double out[3],
212  double derivative[3][3]);
214 
221  int CircuitCheck(vtkAbstractTransform *transform);
222 
225 
227  unsigned long GetMTime();
228 
229 protected:
232 
234  void InternalUpdate();
235 
239 private:
240  vtkGeneralTransform(const vtkGeneralTransform&); // Not implemented.
241  void operator=(const vtkGeneralTransform&); // Not implemented.
242 };
243 
244 
245 #endif
246 
247 
248 
249 
250 
void RotateWXYZ(double angle, const float axis[3])
unsigned long GetMTime()
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:38
vtkTransformConcatenationStack * Stack
allows operations on any transforms
void PrintSelf(ostream &os, vtkIndent indent)
void Concatenate(const double elements[16])
virtual vtkAbstractTransform * MakeTransform()=0
vtkAbstractTransform * GetInverse()
vtkAbstractTransform * GetConcatenatedTransform(int i)
void RotateX(double angle)
virtual void InternalDeepCopy(vtkAbstractTransform *)
void Translate(const float x[3])
virtual int CircuitCheck(vtkAbstractTransform *transform)
vtkAbstractTransform * GetInput()
void Translate(const double x[3])
void RotateWXYZ(double angle, double x, double y, double z)
void Translate(double x, double y, double z)
superclass for all geometric transformations
void RotateY(double angle)
void RotateWXYZ(double angle, const double axis[3])
void RotateZ(double angle)
virtual void InternalTransformPoint(const float in[3], float out[3])=0
double Element[4][4]
Definition: vtkMatrix4x4.h:50
vtkTransformConcatenation * Concatenation
virtual void InternalTransformDerivative(const float in[3], float out[3], float derivative[3][3])=0
void Scale(const double s[3])
void Concatenate(vtkMatrix4x4 *matrix)
static vtkTransformConcatenationStack * New()
void Scale(double x, double y, double z)
vtkAbstractTransform * Input
void Scale(const float s[3])