00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
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   
00037   
00038   
00039   
00040   
00041   
00042   
00043   
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 
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 
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 
00078   static void Zero(double Elements[16]);
00079 
00080 
00082 
00083   void Identity() 
00084     { vtkMatrix4x4::Identity(*this->Element); this->Modified();}
00086 
00087   static void Identity(double Elements[16]);
00088 
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 
00099   static void Invert(const double inElements[16], double outElements[16]);
00100 
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 
00111   static void Transpose(const double inElements[16], double outElements[16]);
00112 
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 
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 
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 
00147   static void Multiply4x4(const double a[16], const double b[16], 
00148                           double c[16]);
00149 
00150 
00152 
00153   void Adjoint(vtkMatrix4x4 *in, vtkMatrix4x4 *out) 
00154     {vtkMatrix4x4::Adjoint(*in->Element,*out->Element);}
00156 
00157   static void Adjoint(const double inElements[16], double outElements[16]);
00158 
00159 
00161   double Determinant() {return vtkMatrix4x4::Determinant(*this->Element);}
00162 
00163   static double Determinant(const double Elements[16]);
00164 
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 
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 
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&);  
00204   void operator= (const vtkMatrix4x4&);  
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