00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00035 #ifndef __vtkGeneralTransform_h
00036 #define __vtkGeneralTransform_h
00037
00038 #include "vtkAbstractTransform.h"
00039
00040 #include "vtkMatrix4x4.h"
00041
00042 class VTK_COMMON_EXPORT vtkGeneralTransform : public vtkAbstractTransform
00043 {
00044 public:
00045 static vtkGeneralTransform *New();
00046
00047 vtkTypeRevisionMacro(vtkGeneralTransform,vtkAbstractTransform);
00048 void PrintSelf(ostream& os, vtkIndent indent);
00049
00053 void Identity() { this->Concatenation->Identity(); this->Modified(); };
00054
00058 void Inverse() { this->Concatenation->Inverse(); this->Modified(); };
00059
00061
00063 void Translate(double x, double y, double z) {
00064 this->Concatenation->Translate(x,y,z); };
00065 void Translate(const double x[3]) { this->Translate(x[0], x[1], x[2]); };
00066 void Translate(const float x[3]) { this->Translate(x[0], x[1], x[2]); };
00068
00070
00074 void RotateWXYZ(double angle, double x, double y, double z) {
00075 this->Concatenation->Rotate(angle,x,y,z); };
00076 void RotateWXYZ(double angle, const double axis[3]) {
00077 this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
00078 void RotateWXYZ(double angle, const float axis[3]) {
00079 this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
00081
00083
00086 void RotateX(double angle) { this->RotateWXYZ(angle, 1, 0, 0); };
00087 void RotateY(double angle) { this->RotateWXYZ(angle, 0, 1, 0); };
00088 void RotateZ(double angle) { this->RotateWXYZ(angle, 0, 0, 1); };
00090
00092
00095 void Scale(double x, double y, double z) {
00096 this->Concatenation->Scale(x,y,z); };
00097 void Scale(const double s[3]) { this->Scale(s[0], s[1], s[2]); };
00098 void Scale(const float s[3]) { this->Scale(s[0], s[1], s[2]); };
00100
00102
00104 void Concatenate(vtkMatrix4x4 *matrix) {
00105 this->Concatenate(*matrix->Element); };
00106 void Concatenate(const double elements[16]) {
00107 this->Concatenation->Concatenate(elements); };
00109
00115 void Concatenate(vtkAbstractTransform *transform);
00116
00118
00123 void PreMultiply() {
00124 if (this->Concatenation->GetPreMultiplyFlag()) { return; }
00125 this->Concatenation->SetPreMultiplyFlag(1); this->Modified(); };
00127
00129
00134 void PostMultiply() {
00135 if (!this->Concatenation->GetPreMultiplyFlag()) { return; }
00136 this->Concatenation->SetPreMultiplyFlag(0); this->Modified(); };
00138
00140
00142 int GetNumberOfConcatenatedTransforms() {
00143 return this->Concatenation->GetNumberOfTransforms() +
00144 (this->Input == NULL ? 0 : 1); };
00146
00148
00153 vtkAbstractTransform *GetConcatenatedTransform(int i) {
00154 if (this->Input == NULL) {
00155 return this->Concatenation->GetTransform(i); }
00156 else if (i < this->Concatenation->GetNumberOfPreTransforms()) {
00157 return this->Concatenation->GetTransform(i); }
00158 else if (i > this->Concatenation->GetNumberOfPreTransforms()) {
00159 return this->Concatenation->GetTransform(i-1); }
00160 else if (this->GetInverseFlag()) {
00161 return this->Input->GetInverse(); }
00162 else {
00163 return this->Input; } };
00165
00167
00173 void SetInput(vtkAbstractTransform *input);
00174 vtkAbstractTransform *GetInput() { return this->Input; };
00176
00178
00182 int GetInverseFlag() {
00183 return this->Concatenation->GetInverseFlag(); };
00185
00187
00188 void Push() { if (this->Stack == NULL) {
00189 this->Stack = vtkTransformConcatenationStack::New(); }
00190 this->Stack->Push(&this->Concatenation);
00191 this->Modified(); };
00193
00195
00197 void Pop() { if (this->Stack == NULL) { return; }
00198 this->Stack->Pop(&this->Concatenation);
00199 this->Modified(); };
00201
00203
00205 void InternalTransformPoint(const float in[3], float out[3]);
00206 void InternalTransformPoint(const double in[3], double out[3]);
00208
00210
00212 void InternalTransformDerivative(const float in[3], float out[3],
00213 float derivative[3][3]);
00214 void InternalTransformDerivative(const double in[3], double out[3],
00215 double derivative[3][3]);
00217
00224 int CircuitCheck(vtkAbstractTransform *transform);
00225
00227 vtkAbstractTransform *MakeTransform();
00228
00230 unsigned long GetMTime();
00231
00232 protected:
00233 vtkGeneralTransform();
00234 ~vtkGeneralTransform();
00235
00236 void InternalDeepCopy(vtkAbstractTransform *t);
00237 void InternalUpdate();
00238
00239 vtkAbstractTransform *Input;
00240 vtkTransformConcatenation *Concatenation;
00241 vtkTransformConcatenationStack *Stack;
00242 private:
00243 vtkGeneralTransform(const vtkGeneralTransform&);
00244 void operator=(const vtkGeneralTransform&);
00245 };
00246
00247
00248 #endif
00249
00250
00251
00252
00253