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-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00008 All rights reserved.
00009 
00010 Redistribution and use in source and binary forms, with or without
00011 modification, are permitted provided that the following conditions are met:
00012 
00013  * Redistributions of source code must retain the above copyright notice,
00014    this list of conditions and the following disclaimer.
00015 
00016  * Redistributions in binary form must reproduce the above copyright notice,
00017    this list of conditions and the following disclaimer in the documentation
00018    and/or other materials provided with the distribution.
00019 
00020  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00021    of any contributors may be used to endorse or promote products derived
00022    from this software without specific prior written permission.
00023 
00024  * Modified source versions must be plainly marked as such, and must not be
00025    misrepresented as being the original software.
00026 
00027 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00028 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00029 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00030 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00031 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00032 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00033 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00034 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00035 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00036 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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&);  // Not implemented.
00267   void operator=(const vtkGeneralTransform&);  // Not implemented.
00268 };
00269 
00270 
00271 #endif
00272 
00273 
00274 
00275 
00276 

Generated on Thu Mar 28 14:19:15 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001