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
00075 #ifndef __vtkTransform_h
00076 #define __vtkTransform_h
00077
00078 #include "vtkLinearTransform.h"
00079 #include "vtkMatrix4x4.h"
00080
00081 class VTK_EXPORT vtkTransform : public vtkLinearTransform
00082 {
00083 public:
00084 static vtkTransform *New();
00085 vtkTypeMacro(vtkTransform,vtkLinearTransform);
00086 void PrintSelf(ostream& os, vtkIndent indent);
00087
00091 void Identity();
00092
00096 void Inverse();
00097
00100 void Translate(double x, double y, double z) {
00101 this->Concatenation->Translate(x,y,z); };
00102 void Translate(const double x[3]) { this->Translate(x[0], x[1], x[2]); };
00103 void Translate(const float x[3]) { this->Translate(x[0], x[1], x[2]); };
00104
00109 void RotateWXYZ(double angle, double x, double y, double z) {
00110 this->Concatenation->Rotate(angle,x,y,z); };
00111 void RotateWXYZ(double angle, const double axis[3]) {
00112 this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
00113 void RotateWXYZ(double angle, const float axis[3]) {
00114 this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
00115
00119 void RotateX(double angle) { this->RotateWXYZ(angle, 1, 0, 0); };
00120 void RotateY(double angle) { this->RotateWXYZ(angle, 0, 1, 0); };
00121 void RotateZ(double angle) { this->RotateWXYZ(angle, 0, 0, 1); };
00122
00126 void Scale(double x, double y, double z) {
00127 this->Concatenation->Scale(x,y,z); };
00128 void Scale(const double s[3]) { this->Scale(s[0], s[1], s[2]); };
00129 void Scale(const float s[3]) { this->Scale(s[0], s[1], s[2]); };
00130
00133 void SetMatrix(vtkMatrix4x4 *matrix) {
00134 this->SetMatrix(*matrix->Element); };
00135 void SetMatrix(const double elements[16]) {
00136 this->Identity(); this->Concatenate(elements); };
00137
00140 void Concatenate(vtkMatrix4x4 *matrix) {
00141 this->Concatenate(*matrix->Element); };
00142 void Concatenate(const double elements[16]) {
00143 this->Concatenation->Concatenate(elements); };
00144
00150 void Concatenate(vtkLinearTransform *transform);
00151
00157 void PreMultiply() {
00158 if (this->Concatenation->GetPreMultiplyFlag()) { return; }
00159 this->Concatenation->SetPreMultiplyFlag(1); this->Modified(); };
00160
00166 void PostMultiply() {
00167 if (!this->Concatenation->GetPreMultiplyFlag()) { return; }
00168 this->Concatenation->SetPreMultiplyFlag(0); this->Modified(); };
00169
00172 void GetOrientation(double orient[3]);
00173 void GetOrientation(float orient[3]) {
00174 double temp[3]; this->GetOrientation(temp);
00175 orient[0] = temp[0]; orient[1] = temp[1]; orient[2] = temp[2]; };
00176 float *GetOrientation() {
00177 this->GetOrientation(this->ReturnValue); return this->ReturnValue; };
00178
00180 void GetOrientationWXYZ(double wxyz[4]);
00181 void GetOrientationWXYZ(float wxyz[3]) {
00182 double temp[4]; this->GetOrientationWXYZ(temp);
00183 wxyz[0]=temp[0]; wxyz[1]=temp[1]; wxyz[2]=temp[2]; wxyz[3]=temp[3];};
00184 float *GetOrientationWXYZ() {
00185 this->GetOrientationWXYZ(this->ReturnValue); return this->ReturnValue; };
00186
00190 void GetPosition(double pos[3]);
00191 void GetPosition(float pos[3]) {
00192 double temp[3]; this->GetPosition(temp);
00193 pos[0] = temp[0]; pos[1] = temp[1]; pos[2] = temp[2]; };
00194 float *GetPosition() {
00195 this->GetPosition(this->ReturnValue); return this->ReturnValue; };
00196
00201 void GetScale(double scale[3]);
00202 void GetScale(float scale[3]) {
00203 double temp[3]; this->GetScale(temp);
00204 scale[0] = temp[0]; scale[1] = temp[1]; scale[2] = temp[2]; };
00205 float *GetScale() {
00206 this->GetScale(this->ReturnValue); return this->ReturnValue; };
00207
00210 void GetInverse(vtkMatrix4x4 *inverse);
00211
00215 void GetTranspose(vtkMatrix4x4 *transpose);
00216
00218 void Push() { if (this->Stack == NULL) {
00219 this->Stack = vtkTransformConcatenationStack::New(); }
00220 this->Stack->Push(&this->Concatenation);
00221 this->Modified(); };
00222
00225 void Pop() { if (this->Stack == NULL) { return; }
00226 this->Stack->Pop(&this->Concatenation);
00227 this->Modified(); };
00228
00233 void SetInput(vtkLinearTransform *input);
00234 vtkLinearTransform *GetInput() { return this->Input; };
00235
00242 int CircuitCheck(vtkAbstractTransform *transform);
00243
00244
00245
00246 vtkAbstractTransform *GetInverse() {
00247 return vtkLinearTransform::GetInverse(); }
00248
00250 vtkAbstractTransform *MakeTransform();
00251
00253 unsigned long GetMTime();
00254
00258 void MultiplyPoint(const float in[4], float out[4]) {
00259 this->GetMatrix()->MultiplyPoint(in,out);};
00260 void MultiplyPoint(const double in[4], double out[4]) {
00261 this->GetMatrix()->MultiplyPoint(in,out);};
00262
00263 #ifndef VTK_REMOVE_LEGACY_CODE
00264
00266 void MultiplyPoints(vtkPoints *inPts, vtkPoints *outPts)
00267 {VTK_LEGACY_METHOD(TransformPoints,"3.2"); this->TransformPoints(inPts,outPts);}
00268 void MultiplyVectors(vtkVectors *inVectors, vtkVectors *outVectors)
00269 {VTK_LEGACY_METHOD(TransformVectors,"3.2"); this->TransformVectors(inVectors,outVectors);}
00270 void MultiplyNormals(vtkNormals *inNormals, vtkNormals *outNormals)
00271 {VTK_LEGACY_METHOD(TransformNormals,"3.2"); this->TransformNormals(inNormals,outNormals);}
00272 #endif
00273
00279 void Transpose()
00280 {VTK_LEGACY_METHOD(Transpose,"3.2");
00281 double matrix[16];
00282 vtkMatrix4x4::DeepCopy(matrix,this->GetMatrix());
00283 vtkMatrix4x4::Transpose(matrix,matrix);
00284 this->Identity();
00285 this->SetInput(NULL);
00286 this->Concatenate(matrix); }
00287
00295 vtkSetVector4Macro(Point,float);
00296 vtkSetVector4Macro(DoublePoint,double);
00297 float *GetPoint();
00298 double *GetDoublePoint();
00299 void GetPoint(float p[4]);
00300
00302 void Multiply4x4(vtkMatrix4x4 *a, vtkMatrix4x4 *b, vtkMatrix4x4 *c)
00303 {VTK_LEGACY_METHOD(Multiply4x4,"3.2"); vtkMatrix4x4::Multiply4x4(a,b,c);}
00304 void Multiply4x4(const double a[16], const double b[16], double c[16])
00305 {VTK_LEGACY_METHOD(Multiply4x4,"3.2"); vtkMatrix4x4::Multiply4x4(a,b,c);}
00306 void Multiply4x4(vtkMatrix4x4 &a, vtkMatrix4x4 &b, vtkMatrix4x4 &c)
00307 {VTK_LEGACY_METHOD(Multiply4x4,"3.2"); vtkMatrix4x4::Multiply4x4(&a,&b,&c); }
00308 void Concatenate(vtkMatrix4x4 &matrix)
00309 {VTK_LEGACY_METHOD(Concatenate,"3.2"); this->Concatenate(&matrix);}
00310 void SetMatrix(vtkMatrix4x4 &m)
00311 {VTK_LEGACY_METHOD(SetMatrix,"3.2"); this->SetMatrix(&m);}
00312 void GetTranspose (vtkMatrix4x4 &transpose)
00313 {VTK_LEGACY_METHOD(GetTranspose,"3.2"); this->GetTranspose(&transpose);}
00314 void GetInverse(vtkMatrix4x4& inverse)
00315 {VTK_LEGACY_METHOD(GetInverse,"3.2"); this->GetInverse(&inverse);};
00316
00317 void GetOrientation(float *prx, float *pry, float *prz)
00318 {VTK_LEGACY_METHOD(GetOrientation,"3.2");
00319 double temp[3]; this->GetOrientation(temp);
00320 *prx = temp[0]; *pry = temp[1]; *prz = temp[2]; };
00321 void GetOrientation(float& rx, float& ry, float& rz)
00322 {VTK_LEGACY_METHOD(GetOrientation,"3.2"); this->GetOrientation(&rx,&ry,&rz);}
00323 void GetPosition(float *px, float *py, float *pz)
00324 {VTK_LEGACY_METHOD(GetPosition,"3.2");
00325 double temp[3]; this->GetPosition(temp);
00326 *px = temp[0]; *py = temp[1]; *pz = temp[2]; };
00327 void GetPosition(float& x, float& y, float& z)
00328 {VTK_LEGACY_METHOD(GetPosition,"3.2"); this->GetPosition(&x, &y, &z);}
00329 void GetScale(float *psx, float *psy, float *psz)
00330 {VTK_LEGACY_METHOD(GetScale,"3.2");
00331 double temp[3]; this->GetScale(temp);
00332 *psx = temp[0]; *psy = temp[1]; *psz = temp[2]; };
00333 void GetScale(float& x, float& y, float& z)
00334 {VTK_LEGACY_METHOD(GetScale,"3.2"); this->GetScale(&x, &y, &z);}
00335
00336
00337 protected:
00338 vtkTransform ();
00339 ~vtkTransform ();
00340 vtkTransform (const vtkTransform& t);
00341 void operator=(const vtkTransform&) {};
00342
00343 void InternalDeepCopy(vtkAbstractTransform *t);
00344
00345 void InternalUpdate();
00346
00347 vtkLinearTransform *Input;
00348 vtkTransformConcatenation *Concatenation;
00349 vtkTransformConcatenationStack *Stack;
00350
00351
00352
00353
00354
00355 unsigned long MatrixUpdateMTime;
00356
00357
00358
00359
00360 float Point[4];
00361 double DoublePoint[4];
00362 float ReturnValue[4];
00363 };
00364
00365 #endif