00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00032 #ifndef __vtkMatrix4x4_h
00033 #define __vtkMatrix4x4_h
00034
00035 #include "vtkObject.h"
00036
00037 class VTK_COMMON_EXPORT vtkMatrix4x4 : public vtkObject
00038 {
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 public:
00049 double Element[4][4];
00050
00052 static vtkMatrix4x4 *New();
00053
00054 vtkTypeMacro(vtkMatrix4x4,vtkObject);
00055 void PrintSelf(ostream& os, vtkIndent indent);
00056
00058
00060 void DeepCopy(vtkMatrix4x4 *source)
00061 {vtkMatrix4x4::DeepCopy(*this->Element,source); this->Modified(); }
00063
00064 static void DeepCopy(double Elements[16], vtkMatrix4x4 *source)
00065 {vtkMatrix4x4::DeepCopy(Elements,*source->Element); }
00066 static void DeepCopy(double Elements[16], const double newElements[16]);
00067
00068
00070
00071 void DeepCopy(const double Elements[16])
00072 { this->DeepCopy(*this->Element,Elements); this->Modified(); }
00074
00076
00077 void Zero()
00078 { vtkMatrix4x4::Zero(*this->Element); this->Modified(); }
00080
00081 static void Zero(double Elements[16]);
00082
00083
00085
00086 void Identity()
00087 { vtkMatrix4x4::Identity(*this->Element); this->Modified();}
00089
00090 static void Identity(double Elements[16]);
00091
00092
00094
00096 static void Invert(vtkMatrix4x4 *in, vtkMatrix4x4 *out)
00097 {vtkMatrix4x4::Invert(*in->Element,*out->Element); out->Modified(); }
00098 void Invert()
00099 { vtkMatrix4x4::Invert(this,this); }
00101
00102 static void Invert(const double inElements[16], double outElements[16]);
00103
00104
00105
00107
00108 static void Transpose(vtkMatrix4x4 *in, vtkMatrix4x4 *out)
00109 {vtkMatrix4x4::Transpose(*in->Element,*out->Element); out->Modified(); }
00110 void Transpose()
00111 { vtkMatrix4x4::Transpose(this,this); }
00113
00114 static void Transpose(const double inElements[16], double outElements[16]);
00115
00116
00118
00120 void MultiplyPoint(const float in[4], float out[4])
00121 {vtkMatrix4x4::MultiplyPoint(*this->Element,in,out); }
00122 void MultiplyPoint(const double in[4], double out[4])
00123 {vtkMatrix4x4::MultiplyPoint(*this->Element,in,out); }
00125
00126
00127 static void MultiplyPoint(const double Elements[16],
00128 const float in[4], float out[4]);
00129 static void MultiplyPoint(const double Elements[16],
00130 const double in[4], double out[4]);
00131
00132
00134
00136 float *MultiplyPoint(const float in[4])
00137 {return this->MultiplyFloatPoint(in); }
00138 float *MultiplyFloatPoint(const float in[4])
00139 {this->MultiplyPoint(in,this->FloatPoint); return this->FloatPoint; }
00140 double *MultiplyDoublePoint(const double in[4])
00141 {this->MultiplyPoint(in,this->DoublePoint); return this->DoublePoint; }
00143
00145
00146 static void Multiply4x4(vtkMatrix4x4 *a, vtkMatrix4x4 *b, vtkMatrix4x4 *c) {
00147 vtkMatrix4x4::Multiply4x4(*a->Element,*b->Element,*c->Element); };
00149
00150 static void Multiply4x4(const double a[16], const double b[16],
00151 double c[16]);
00152
00153
00155
00156 void Adjoint(vtkMatrix4x4 *in, vtkMatrix4x4 *out)
00157 {vtkMatrix4x4::Adjoint(*in->Element,*out->Element);}
00159
00160 static void Adjoint(const double inElements[16], double outElements[16]);
00161
00162
00164 double Determinant() {return vtkMatrix4x4::Determinant(*this->Element);}
00165
00166 static double Determinant(const double Elements[16]);
00167
00168
00170 void SetElement(int i, int j, double value);
00171
00173
00174 double GetElement(int i, int j) const
00175 {return this->Element[i][j];}
00177
00178
00179 double *operator[](const unsigned int i)
00180 {return &(this->Element[i][0]);}
00181 const double *operator[](unsigned int i) const
00182 { return &(this->Element[i][0]); }
00183 void Adjoint(vtkMatrix4x4 &in,vtkMatrix4x4 &out)
00184 {this->Adjoint(&in,&out);}
00185 double Determinant(vtkMatrix4x4 &in)
00186 {return this->Determinant(&in);}
00187 double Determinant(vtkMatrix4x4 *in)
00188 {return vtkMatrix4x4::Determinant(*in->Element);}
00189 void Invert(vtkMatrix4x4 &in,vtkMatrix4x4 &out)
00190 {this->Invert(&in,&out);}
00191 void Transpose(vtkMatrix4x4 &in,vtkMatrix4x4 &out)
00192 {this->Transpose(&in,&out);}
00193 static void PointMultiply(const double Elements[16],
00194 const float in[4], float out[4]);
00195 static void PointMultiply(const double Elements[16],
00196 const double in[4], double out[4]);
00197
00198
00199 protected:
00200 vtkMatrix4x4() { vtkMatrix4x4::Identity(*this->Element); };
00201 ~vtkMatrix4x4() {};
00202
00203 float FloatPoint[4];
00204 double DoublePoint[4];
00205 private:
00206 vtkMatrix4x4(const vtkMatrix4x4&);
00207 void operator= (const vtkMatrix4x4&);
00208 };
00209
00210 inline void vtkMatrix4x4::SetElement(int i, int j, double value)
00211 {
00212 if (this->Element[i][j] != value)
00213 {
00214 this->Element[i][j] = value;
00215 this->Modified();
00216 }
00217 }
00218
00219 #endif
00220