00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00079 #ifndef __vtkTransform_h
00080 #define __vtkTransform_h
00081
00082 #include "vtkLinearTransform.h"
00083 #include "vtkMatrix4x4.h"
00084
00085 class VTK_COMMON_EXPORT vtkTransform : public vtkLinearTransform
00086 {
00087 public:
00088 static vtkTransform *New();
00089 vtkTypeMacro(vtkTransform,vtkLinearTransform);
00090 void PrintSelf(ostream& os, vtkIndent indent);
00091
00095 void Identity();
00096
00100 void Inverse();
00101
00103
00105 void Translate(double x, double y, double z) {
00106 this->Concatenation->Translate(x,y,z); };
00107 void Translate(const double x[3]) { this->Translate(x[0], x[1], x[2]); };
00108 void Translate(const float x[3]) { this->Translate(x[0], x[1], x[2]); };
00110
00112
00116 void RotateWXYZ(double angle, double x, double y, double z) {
00117 this->Concatenation->Rotate(angle,x,y,z); };
00118 void RotateWXYZ(double angle, const double axis[3]) {
00119 this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
00120 void RotateWXYZ(double angle, const float axis[3]) {
00121 this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
00123
00125
00128 void RotateX(double angle) { this->RotateWXYZ(angle, 1, 0, 0); };
00129 void RotateY(double angle) { this->RotateWXYZ(angle, 0, 1, 0); };
00130 void RotateZ(double angle) { this->RotateWXYZ(angle, 0, 0, 1); };
00132
00134
00137 void Scale(double x, double y, double z) {
00138 this->Concatenation->Scale(x,y,z); };
00139 void Scale(const double s[3]) { this->Scale(s[0], s[1], s[2]); };
00140 void Scale(const float s[3]) { this->Scale(s[0], s[1], s[2]); };
00142
00144
00146 void SetMatrix(vtkMatrix4x4 *matrix) {
00147 this->SetMatrix(*matrix->Element); };
00148 void SetMatrix(const double elements[16]) {
00149 this->Identity(); this->Concatenate(elements); };
00151
00153
00155 void Concatenate(vtkMatrix4x4 *matrix) {
00156 this->Concatenate(*matrix->Element); };
00157 void Concatenate(const double elements[16]) {
00158 this->Concatenation->Concatenate(elements); };
00160
00166 void Concatenate(vtkLinearTransform *transform);
00167
00169
00174 void PreMultiply() {
00175 if (this->Concatenation->GetPreMultiplyFlag()) { return; }
00176 this->Concatenation->SetPreMultiplyFlag(1); this->Modified(); };
00178
00180
00185 void PostMultiply() {
00186 if (!this->Concatenation->GetPreMultiplyFlag()) { return; }
00187 this->Concatenation->SetPreMultiplyFlag(0); this->Modified(); };
00189
00191
00193 int GetNumberOfConcatenatedTransforms() {
00194 return this->Concatenation->GetNumberOfTransforms() +
00195 (this->Input == NULL ? 0 : 1); };
00197
00199
00204 vtkLinearTransform *GetConcatenatedTransform(int i) {
00205 if (this->Input == NULL) {
00206 return (vtkLinearTransform *)this->Concatenation->GetTransform(i); }
00207 else if (i < this->Concatenation->GetNumberOfPreTransforms()) {
00208 return (vtkLinearTransform *)this->Concatenation->GetTransform(i); }
00209 else if (i > this->Concatenation->GetNumberOfPreTransforms()) {
00210 return (vtkLinearTransform *)this->Concatenation->GetTransform(i-1); }
00211 else if (this->GetInverseFlag()) {
00212 return (vtkLinearTransform *)this->Input->GetInverse(); }
00213 else {
00214 return (vtkLinearTransform *)this->Input; } };
00216
00218
00220 void GetOrientation(double orient[3]);
00221 void GetOrientation(float orient[3]) {
00222 double temp[3]; this->GetOrientation(temp);
00223 orient[0] = temp[0]; orient[1] = temp[1]; orient[2] = temp[2]; };
00224 float *GetOrientation() {
00225 this->GetOrientation(this->ReturnValue); return this->ReturnValue; };
00227
00229
00230 void GetOrientationWXYZ(double wxyz[4]);
00231 void GetOrientationWXYZ(float wxyz[3]) {
00232 double temp[4]; this->GetOrientationWXYZ(temp);
00233 wxyz[0]=temp[0]; wxyz[1]=temp[1]; wxyz[2]=temp[2]; wxyz[3]=temp[3];};
00234 float *GetOrientationWXYZ() {
00235 this->GetOrientationWXYZ(this->ReturnValue); return this->ReturnValue; };
00237
00239
00242 void GetPosition(double pos[3]);
00243 void GetPosition(float pos[3]) {
00244 double temp[3]; this->GetPosition(temp);
00245 pos[0] = temp[0]; pos[1] = temp[1]; pos[2] = temp[2]; };
00246 float *GetPosition() {
00247 this->GetPosition(this->ReturnValue); return this->ReturnValue; };
00249
00251
00255 void GetScale(double scale[3]);
00256 void GetScale(float scale[3]) {
00257 double temp[3]; this->GetScale(temp);
00258 scale[0] = temp[0]; scale[1] = temp[1]; scale[2] = temp[2]; };
00259 float *GetScale() {
00260 this->GetScale(this->ReturnValue); return this->ReturnValue; };
00262
00265 void GetInverse(vtkMatrix4x4 *inverse);
00266
00270 void GetTranspose(vtkMatrix4x4 *transpose);
00271
00273
00279 void SetInput(vtkLinearTransform *input);
00280 vtkLinearTransform *GetInput() { return this->Input; };
00282
00284
00288 int GetInverseFlag() {
00289 return this->Concatenation->GetInverseFlag(); };
00291
00293
00294 void Push() { if (this->Stack == NULL) {
00295 this->Stack = vtkTransformConcatenationStack::New(); }
00296 this->Stack->Push(&this->Concatenation);
00297 this->Modified(); };
00299
00301
00303 void Pop() { if (this->Stack == NULL) { return; }
00304 this->Stack->Pop(&this->Concatenation);
00305 this->Modified(); };
00307
00314 int CircuitCheck(vtkAbstractTransform *transform);
00315
00316
00317
00318 vtkAbstractTransform *GetInverse() {
00319 return vtkLinearTransform::GetInverse(); }
00320
00322 vtkAbstractTransform *MakeTransform();
00323
00325 unsigned long GetMTime();
00326
00328
00331 void MultiplyPoint(const float in[4], float out[4]) {
00332 this->GetMatrix()->MultiplyPoint(in,out);};
00333 void MultiplyPoint(const double in[4], double out[4]) {
00334 this->GetMatrix()->MultiplyPoint(in,out);};
00336
00337 protected:
00338 vtkTransform ();
00339 ~vtkTransform ();
00340
00341 void InternalDeepCopy(vtkAbstractTransform *t);
00342
00343 void InternalUpdate();
00344
00345 vtkLinearTransform *Input;
00346 vtkTransformConcatenation *Concatenation;
00347 vtkTransformConcatenationStack *Stack;
00348
00349
00350
00351 unsigned long MatrixUpdateMTime;
00352
00353 float Point[4];
00354 double DoublePoint[4];
00355 float ReturnValue[4];
00356 private:
00357 vtkTransform (const vtkTransform& t);
00358 void operator=(const vtkTransform&);
00359 };
00360
00361 #endif