Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkMatrix4x4.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkMatrix4x4.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00029 #ifndef __vtkMatrix4x4_h
00030 #define __vtkMatrix4x4_h
00031 
00032 #include "vtkObject.h"
00033 
00034 class VTK_COMMON_EXPORT vtkMatrix4x4 : public vtkObject
00035 {
00036   // Some of the methods in here have a corresponding static (class)
00037   // method taking a pointer to 16 doubles that constitutes a user
00038   // supplied matrix. This allows C++ clients to allocate double arrays
00039   // on the stack and manipulate them using vtkMatrix4x4 methods. 
00040   // This is an alternative to allowing vtkMatrix4x4 instances to be
00041   // created on the stack (which is frowned upon) or doing lots of
00042   // temporary heap allocation within vtkTransform and vtkActor methods,
00043   // which is inefficient.
00044 
00045 public:
00046   double Element[4][4];
00047 
00049   static vtkMatrix4x4 *New();
00050 
00051   vtkTypeRevisionMacro(vtkMatrix4x4,vtkObject);
00052   void PrintSelf(ostream& os, vtkIndent indent);
00053   
00055 
00057   void DeepCopy(vtkMatrix4x4 *source) 
00058     {vtkMatrix4x4::DeepCopy(*this->Element,source); this->Modified(); }
00060 //BTX
00061   static void DeepCopy(double Elements[16], vtkMatrix4x4 *source) 
00062     {vtkMatrix4x4::DeepCopy(Elements,*source->Element); }
00063   static void DeepCopy(double Elements[16], const double newElements[16]);
00064 //ETX
00065 
00067 
00068   void DeepCopy(const double Elements[16]) 
00069     { this->DeepCopy(*this->Element,Elements); this->Modified(); }
00071 
00073 
00074   void Zero() 
00075     { vtkMatrix4x4::Zero(*this->Element); this->Modified(); }
00077 //BTX
00078   static void Zero(double Elements[16]);
00079 //ETX  
00080 
00082 
00083   void Identity() 
00084     { vtkMatrix4x4::Identity(*this->Element); this->Modified();}
00086 //BTX
00087   static void Identity(double Elements[16]);
00088 //ETX  
00089 
00091 
00093   static void Invert(vtkMatrix4x4 *in, vtkMatrix4x4 *out) 
00094     {vtkMatrix4x4::Invert(*in->Element,*out->Element); out->Modified(); }
00095   void Invert() 
00096     { vtkMatrix4x4::Invert(this,this); }
00098 //BTX
00099   static void Invert(const double inElements[16], double outElements[16]);
00100 //ETX
00101 
00102 
00104 
00105   static void Transpose(vtkMatrix4x4 *in, vtkMatrix4x4 *out) 
00106     {vtkMatrix4x4::Transpose(*in->Element,*out->Element); out->Modified(); }
00107   void Transpose() 
00108     { vtkMatrix4x4::Transpose(this,this); }
00110 //BTX
00111   static void Transpose(const double inElements[16], double outElements[16]);
00112 //ETX
00113 
00115 
00117   void MultiplyPoint(const float in[4], float out[4]) 
00118     {vtkMatrix4x4::MultiplyPoint(*this->Element,in,out); }
00119   void MultiplyPoint(const double in[4], double out[4]) 
00120     {vtkMatrix4x4::MultiplyPoint(*this->Element,in,out); }
00122 
00123 //BTX
00124   static void MultiplyPoint(const double Elements[16], 
00125                             const float in[4], float out[4]);
00126   static void MultiplyPoint(const double Elements[16], 
00127                             const double in[4], double out[4]);
00128 //ETX
00129 
00131 
00133   float *MultiplyPoint(const float in[4]) 
00134     {return this->MultiplyFloatPoint(in); }
00135   float *MultiplyFloatPoint(const float in[4]) 
00136     {this->MultiplyPoint(in,this->FloatPoint); return this->FloatPoint; } 
00137   double *MultiplyDoublePoint(const double in[4]) 
00138     {this->MultiplyPoint(in,this->DoublePoint); return this->DoublePoint; } 
00140 
00142 
00143   static void Multiply4x4(vtkMatrix4x4 *a, vtkMatrix4x4 *b, vtkMatrix4x4 *c) {
00144     vtkMatrix4x4::Multiply4x4(*a->Element,*b->Element,*c->Element); };
00146 //BTX
00147   static void Multiply4x4(const double a[16], const double b[16], 
00148                           double c[16]);
00149 //ETX
00150 
00152 
00153   void Adjoint(vtkMatrix4x4 *in, vtkMatrix4x4 *out) 
00154     {vtkMatrix4x4::Adjoint(*in->Element,*out->Element);}
00156 //BTX
00157   static void Adjoint(const double inElements[16], double outElements[16]);
00158 //ETX
00159 
00161   double Determinant() {return vtkMatrix4x4::Determinant(*this->Element);}
00162 //BTX
00163   static double Determinant(const double Elements[16]);
00164 //ETX
00165 
00167   void SetElement(int i, int j, double value);
00168 
00170 
00171   double GetElement(int i, int j) const 
00172     {return this->Element[i][j];}
00174 
00175 //BTX
00176   double *operator[](const unsigned int i) 
00177     {return &(this->Element[i][0]);}
00178   const double *operator[](unsigned int i) const
00179     { return &(this->Element[i][0]); }  
00180   void Adjoint(vtkMatrix4x4 &in,vtkMatrix4x4 &out)
00181     {this->Adjoint(&in,&out);}
00182   double Determinant(vtkMatrix4x4 &in) 
00183     {return this->Determinant(&in);}
00184   double Determinant(vtkMatrix4x4 *in) 
00185     {return vtkMatrix4x4::Determinant(*in->Element);}
00186   void Invert(vtkMatrix4x4 &in,vtkMatrix4x4 &out)
00187     {this->Invert(&in,&out);}
00188   void Transpose(vtkMatrix4x4 &in,vtkMatrix4x4 &out)
00189     {this->Transpose(&in,&out);}
00190   static void PointMultiply(const double Elements[16], 
00191                             const float in[4], float out[4]);
00192   static void PointMultiply(const double Elements[16], 
00193                             const double in[4], double out[4]);
00194 //ETX
00195 
00196 protected:
00197   vtkMatrix4x4() { vtkMatrix4x4::Identity(*this->Element); };
00198   ~vtkMatrix4x4() {};
00199   
00200   float FloatPoint[4];
00201   double DoublePoint[4];
00202 private:
00203   vtkMatrix4x4(const vtkMatrix4x4&);  // Not implemented
00204   void operator= (const vtkMatrix4x4&);  // Not implemented
00205 };
00206 
00207 inline void vtkMatrix4x4::SetElement(int i, int j, double value)
00208 {
00209   if (this->Element[i][j] != value)
00210     {
00211     this->Element[i][j] = value;
00212     this->Modified();
00213     }
00214 }
00215 
00216 #endif
00217 

Generated on Mon Jan 21 23:07:17 2008 for VTK by  doxygen 1.4.3-20050530