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
00060 #include "vtkAbstractTransform.h"
00061
00062 #ifndef __vtkGeneralTransform_h
00063 #define __vtkGeneralTransform_h
00064
00065 class VTK_COMMON_EXPORT vtkGeneralTransform : public vtkAbstractTransform
00066 {
00067 public:
00068 static vtkGeneralTransform *New();
00069
00070 vtkTypeMacro(vtkGeneralTransform,vtkAbstractTransform);
00071 void PrintSelf(ostream& os, vtkIndent indent);
00072
00076 void Identity() { this->Concatenation->Identity(); this->Modified(); };
00077
00081 void Inverse() { this->Concatenation->Inverse(); this->Modified(); };
00082
00084
00086 void Translate(double x, double y, double z) {
00087 this->Concatenation->Translate(x,y,z); };
00088 void Translate(const double x[3]) { this->Translate(x[0], x[1], x[2]); };
00089 void Translate(const float x[3]) { this->Translate(x[0], x[1], x[2]); };
00091
00093
00097 void RotateWXYZ(double angle, double x, double y, double z) {
00098 this->Concatenation->Rotate(angle,x,y,z); };
00099 void RotateWXYZ(double angle, const double axis[3]) {
00100 this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
00101 void RotateWXYZ(double angle, const float axis[3]) {
00102 this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
00104
00106
00109 void RotateX(double angle) { this->RotateWXYZ(angle, 1, 0, 0); };
00110 void RotateY(double angle) { this->RotateWXYZ(angle, 0, 1, 0); };
00111 void RotateZ(double angle) { this->RotateWXYZ(angle, 0, 0, 1); };
00113
00115
00118 void Scale(double x, double y, double z) {
00119 this->Concatenation->Scale(x,y,z); };
00120 void Scale(const double s[3]) { this->Scale(s[0], s[1], s[2]); };
00121 void Scale(const float s[3]) { this->Scale(s[0], s[1], s[2]); };
00123
00125
00127 void Concatenate(vtkMatrix4x4 *matrix) {
00128 this->Concatenate(*matrix->Element); };
00129 void Concatenate(const double elements[16]) {
00130 this->Concatenation->Concatenate(elements); };
00132
00138 void Concatenate(vtkAbstractTransform *transform);
00139
00141
00146 void PreMultiply() {
00147 if (this->Concatenation->GetPreMultiplyFlag()) { return; }
00148 this->Concatenation->SetPreMultiplyFlag(1); this->Modified(); };
00150
00152
00157 void PostMultiply() {
00158 if (!this->Concatenation->GetPreMultiplyFlag()) { return; }
00159 this->Concatenation->SetPreMultiplyFlag(0); this->Modified(); };
00161
00163
00165 int GetNumberOfConcatenatedTransforms() {
00166 return this->Concatenation->GetNumberOfTransforms() +
00167 (this->Input == NULL ? 0 : 1); };
00169
00171
00176 vtkAbstractTransform *GetConcatenatedTransform(int i) {
00177 if (this->Input == NULL) {
00178 return this->Concatenation->GetTransform(i); }
00179 else if (i < this->Concatenation->GetNumberOfPreTransforms()) {
00180 return this->Concatenation->GetTransform(i); }
00181 else if (i > this->Concatenation->GetNumberOfPreTransforms()) {
00182 return this->Concatenation->GetTransform(i-1); }
00183 else if (this->GetInverseFlag()) {
00184 return this->Input->GetInverse(); }
00185 else {
00186 return this->Input; } };
00188
00190
00196 void SetInput(vtkAbstractTransform *input);
00197 vtkAbstractTransform *GetInput() { return this->Input; };
00199
00201
00205 int GetInverseFlag() {
00206 return this->Concatenation->GetInverseFlag(); };
00208
00210
00211 void Push() { if (this->Stack == NULL) {
00212 this->Stack = vtkTransformConcatenationStack::New(); }
00213 this->Stack->Push(&this->Concatenation);
00214 this->Modified(); };
00216
00218
00220 void Pop() { if (this->Stack == NULL) { return; }
00221 this->Stack->Pop(&this->Concatenation);
00222 this->Modified(); };
00224
00226
00228 void InternalTransformPoint(const float in[3], float out[3]);
00229 void InternalTransformPoint(const double in[3], double out[3]);
00231
00233
00235 void InternalTransformDerivative(const float in[3], float out[3],
00236 float derivative[3][3]);
00237 void InternalTransformDerivative(const double in[3], double out[3],
00238 double derivative[3][3]);
00240
00247 int CircuitCheck(vtkAbstractTransform *transform);
00248
00250 vtkAbstractTransform *MakeTransform();
00251
00253 unsigned long GetMTime();
00254
00255 protected:
00256 vtkGeneralTransform();
00257 ~vtkGeneralTransform();
00258
00259 void InternalDeepCopy(vtkAbstractTransform *t);
00260 void InternalUpdate();
00261
00262 vtkAbstractTransform *Input;
00263 vtkTransformConcatenation *Concatenation;
00264 vtkTransformConcatenationStack *Stack;
00265 private:
00266 vtkGeneralTransform(const vtkGeneralTransform&);
00267 void operator=(const vtkGeneralTransform&);
00268 };
00269
00270
00271 #endif
00272
00273
00274
00275
00276