Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# Common/vtkGeneralTransform.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program:   Visualization Toolkit
    00004   Module:    $RCSfile: vtkGeneralTransform.h,v $
    00005   Language:  C++
    00006
    00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
    00008   All rights reserved.
    00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
    00010
    00011      This software is distributed WITHOUT ANY WARRANTY; without even
    00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00013      PURPOSE.  See the above copyright notice for more information.
    00014
    00015 =========================================================================*/
    00045 #ifndef __vtkGeneralTransform_h
    00046 #define __vtkGeneralTransform_h
    00047
    00048 #include "vtkAbstractTransform.h"
    00049
    00050 #include "vtkMatrix4x4.h" // Needed for inline methods
    00051
    00052 class VTK_COMMON_EXPORT vtkGeneralTransform : public vtkAbstractTransform
    00053 {
    00054 public:
    00055   static vtkGeneralTransform *New();
    00056
    00057   vtkTypeRevisionMacro(vtkGeneralTransform,vtkAbstractTransform);
    00058   void PrintSelf(ostream& os, vtkIndent indent);
    00059
    00063   void Identity() { this->Concatenation->Identity(); this->Modified(); };
    00064
    00068   void Inverse() { this->Concatenation->Inverse(); this->Modified(); };
    00069
    00071
    00073   void Translate(double x, double y, double z) {
    00074     this->Concatenation->Translate(x,y,z); };
    00075   void Translate(const double x[3]) { this->Translate(x[0], x[1], x[2]); };
    00076   void Translate(const float x[3]) { this->Translate(x[0], x[1], x[2]); };
    00078
    00080
    00084   void RotateWXYZ(double angle, double x, double y, double z) {
    00085     this->Concatenation->Rotate(angle,x,y,z); };
    00086   void RotateWXYZ(double angle, const double axis[3]) {
    00087     this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
    00088   void RotateWXYZ(double angle, const float axis[3]) {
    00089     this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
    00091
    00093
    00096   void RotateX(double angle) { this->RotateWXYZ(angle, 1, 0, 0); };
    00097   void RotateY(double angle) { this->RotateWXYZ(angle, 0, 1, 0); };
    00098   void RotateZ(double angle) { this->RotateWXYZ(angle, 0, 0, 1); };
    00100
    00102
    00105   void Scale(double x, double y, double z) {
    00106     this->Concatenation->Scale(x,y,z); };
    00107   void Scale(const double s[3]) { this->Scale(s[0], s[1], s[2]); };
    00108   void Scale(const float s[3]) { this->Scale(s[0], s[1], s[2]); };
    00110
    00112
    00114   void Concatenate(vtkMatrix4x4 *matrix) {
    00115     this->Concatenate(*matrix->Element); };
    00116   void Concatenate(const double elements[16]) {
    00117     this->Concatenation->Concatenate(elements); };
    00119
    00125   void Concatenate(vtkAbstractTransform *transform);
    00126
    00128
    00133   void PreMultiply() {
    00134     if (this->Concatenation->GetPreMultiplyFlag()) { return; }
    00135     this->Concatenation->SetPreMultiplyFlag(1); this->Modified(); };
    00137
    00139
    00144   void PostMultiply()  {
    00145     if (!this->Concatenation->GetPreMultiplyFlag()) { return; }
    00146     this->Concatenation->SetPreMultiplyFlag(0); this->Modified(); };
    00148
    00150
    00152   int GetNumberOfConcatenatedTransforms() {
    00153     return this->Concatenation->GetNumberOfTransforms() +
    00154       (this->Input == NULL ? 0 : 1); };
    00156
    00158
    00163   vtkAbstractTransform *GetConcatenatedTransform(int i) {
    00164     if (this->Input == NULL) {
    00165       return this->Concatenation->GetTransform(i); }
    00166     else if (i < this->Concatenation->GetNumberOfPreTransforms()) {
    00167       return this->Concatenation->GetTransform(i); }
    00168     else if (i > this->Concatenation->GetNumberOfPreTransforms()) {
    00169       return this->Concatenation->GetTransform(i-1); }
    00170     else if (this->GetInverseFlag()) {
    00171       return this->Input->GetInverse(); }
    00172     else {
    00173       return this->Input; } };
    00175
    00177
    00183   void SetInput(vtkAbstractTransform *input);
    00184   vtkAbstractTransform *GetInput() { return this->Input; };
    00186
    00188
    00192   int GetInverseFlag() {
    00193     return this->Concatenation->GetInverseFlag(); };
    00195
    00197
    00198   void Push() { if (this->Stack == NULL) {
    00199                     this->Stack = vtkTransformConcatenationStack::New(); }
    00200                 this->Stack->Push(&this->Concatenation);
    00201                 this->Modified(); };
    00203
    00205
    00207   void Pop() { if (this->Stack == NULL) { return; }
    00208                this->Stack->Pop(&this->Concatenation);
    00209                this->Modified(); };
    00211
    00213
    00215   void InternalTransformPoint(const float in[3], float out[3]);
    00216   void InternalTransformPoint(const double in[3], double out[3]);
    00218
    00220
    00222   void InternalTransformDerivative(const float in[3], float out[3],
    00223                                    float derivative[3][3]);
    00224   void InternalTransformDerivative(const double in[3], double out[3],
    00225                                    double derivative[3][3]);
    00227
    00234   int CircuitCheck(vtkAbstractTransform *transform);
    00235
    00237   vtkAbstractTransform *MakeTransform();
    00238
    00240   unsigned long GetMTime();
    00241
    00242 protected:
    00243   vtkGeneralTransform();
    00244   ~vtkGeneralTransform();
    00245
    00246   void InternalDeepCopy(vtkAbstractTransform *t);
    00247   void InternalUpdate();
    00248
    00249   vtkAbstractTransform *Input;
    00250   vtkTransformConcatenation *Concatenation;
    00251   vtkTransformConcatenationStack *Stack;
    00252 private:
    00253   vtkGeneralTransform(const vtkGeneralTransform&);  // Not implemented.
    00254   void operator=(const vtkGeneralTransform&);  // Not implemented.
    00255 };
    00256
    00257
    00258 #endif
    00259
    00260
    00261
    00262
    00263