VTK
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 "vtkAbstractTransform.h"
35 
36 #include "vtkMatrix4x4.h" // Needed for inline methods
37 
39 {
40 public:
41  static vtkGeneralTransform *New();
42 
44  void PrintSelf(ostream& os, vtkIndent indent);
45 
49  void Identity() { this->Concatenation->Identity(); this->Modified(); };
50 
54  void Inverse() { this->Concatenation->Inverse(); this->Modified(); };
55 
57 
59  void Translate(double x, double y, double z) {
60  this->Concatenation->Translate(x,y,z); };
61  void Translate(const double x[3]) { this->Translate(x[0], x[1], x[2]); };
62  void Translate(const float x[3]) { this->Translate(x[0], x[1], x[2]); };
64 
66 
70  void RotateWXYZ(double angle, double x, double y, double z) {
71  this->Concatenation->Rotate(angle,x,y,z); };
72  void RotateWXYZ(double angle, const double axis[3]) {
73  this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
74  void RotateWXYZ(double angle, const float axis[3]) {
75  this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
77 
79 
82  void RotateX(double angle) { this->RotateWXYZ(angle, 1, 0, 0); };
83  void RotateY(double angle) { this->RotateWXYZ(angle, 0, 1, 0); };
84  void RotateZ(double angle) { this->RotateWXYZ(angle, 0, 0, 1); };
86 
88 
91  void Scale(double x, double y, double z) {
92  this->Concatenation->Scale(x,y,z); };
93  void Scale(const double s[3]) { this->Scale(s[0], s[1], s[2]); };
94  void Scale(const float s[3]) { this->Scale(s[0], s[1], s[2]); };
96 
98 
100  void Concatenate(vtkMatrix4x4 *matrix) {
101  this->Concatenate(*matrix->Element); };
102  void Concatenate(const double elements[16]) {
103  this->Concatenation->Concatenate(elements); };
105 
111  void Concatenate(vtkAbstractTransform *transform);
112 
114 
119  void PreMultiply() {
120  if (this->Concatenation->GetPreMultiplyFlag()) { return; }
121  this->Concatenation->SetPreMultiplyFlag(1); this->Modified(); };
123 
125 
130  void PostMultiply() {
131  if (!this->Concatenation->GetPreMultiplyFlag()) { return; }
132  this->Concatenation->SetPreMultiplyFlag(0); this->Modified(); };
134 
136 
139  return this->Concatenation->GetNumberOfTransforms() +
140  (this->Input == NULL ? 0 : 1); };
142 
144 
150  if (this->Input == NULL) {
151  return this->Concatenation->GetTransform(i); }
152  else if (i < this->Concatenation->GetNumberOfPreTransforms()) {
153  return this->Concatenation->GetTransform(i); }
154  else if (i > this->Concatenation->GetNumberOfPreTransforms()) {
155  return this->Concatenation->GetTransform(i-1); }
156  else if (this->GetInverseFlag()) {
157  return this->Input->GetInverse(); }
158  else {
159  return this->Input; } };
161 
163 
169  void SetInput(vtkAbstractTransform *input);
170  vtkAbstractTransform *GetInput() { return this->Input; };
172 
174 
179  return this->Concatenation->GetInverseFlag(); };
181 
183 
184  void Push() { if (this->Stack == NULL) {
185  this->Stack = vtkTransformConcatenationStack::New(); }
186  this->Stack->Push(&this->Concatenation);
187  this->Modified(); };
189 
191 
193  void Pop() { if (this->Stack == NULL) { return; }
194  this->Stack->Pop(&this->Concatenation);
195  this->Modified(); };
197 
199 
201  void InternalTransformPoint(const float in[3], float out[3]);
202  void InternalTransformPoint(const double in[3], double out[3]);
204 
206 
208  void InternalTransformDerivative(const float in[3], float out[3],
209  float derivative[3][3]);
210  void InternalTransformDerivative(const double in[3], double out[3],
211  double derivative[3][3]);
213 
220  int CircuitCheck(vtkAbstractTransform *transform);
221 
224 
226  unsigned long GetMTime();
227 
228 protected:
231 
233  void InternalUpdate();
234 
238 private:
239  vtkGeneralTransform(const vtkGeneralTransform&); // Not implemented.
240  void operator=(const vtkGeneralTransform&); // Not implemented.
241 };
242 
243 
244 #endif
245 
246 
247 
248 
249 
void RotateWXYZ(double angle, const float axis[3])
unsigned long GetMTime()
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:37
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)
a simple class to control print indentation
Definition: vtkIndent.h:37
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)
#define VTK_COMMON_EXPORT
virtual void Modified()
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:49
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 vtkObject * New()
static vtkTransformConcatenationStack * New()
void Scale(double x, double y, double z)
vtkAbstractTransform * Input
void Scale(const float s[3])