00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072 #ifndef __FK_MATRIX_HEADER__
00073 #define __FK_MATRIX_HEADER__
00074
00075 #include <FK/Vector.h>
00076 #include <FK/Angle.h>
00077
00078 const double FK_MATRIX_EPS = 1.0e-12;
00079 const double FK_MATRIX_EPS2 = 1.0e-16;
00080
00081
00082
00084
00114 class fk_OrthoMatrix {
00115 friend class fk_Matrix;
00116 friend class fk_Vector;
00117 friend class fk_HVector;
00118
00119 protected:
00120
00121 #ifndef FK_DOXYGEN_USER_PROCESS
00122
00123 double m[4][4];
00124 void MultVec(fk_HVector &, const fk_HVector &) const;
00125
00126 #endif
00127
00128 public:
00129
00131
00134 fk_OrthoMatrix(void);
00135
00137 fk_OrthoMatrix(const fk_OrthoMatrix &);
00138
00140
00141
00143
00152 fk_OrthoMatrix operator !(void) const;
00153
00155
00202 double * operator [](int);
00203
00204
00205
00207
00208
00210
00224 bool operator ==(const fk_OrthoMatrix &) const;
00225
00227
00241 bool operator !=(const fk_OrthoMatrix &) const;
00242
00243
00245
00246
00248 fk_OrthoMatrix & operator =(const fk_OrthoMatrix &);
00249
00251
00270 fk_OrthoMatrix & operator *=(const fk_OrthoMatrix &);
00271
00272
00273
00275
00277
00280 void init(void);
00281
00283
00298 void set(int row, int col, double value);
00299
00301
00308 bool inverse(void);
00309
00311
00316 void negate(void);
00317
00319
00324 void makeRot(double rad, fk_Axis axis);
00325
00327
00333 void makeTrans(double x, double y, double z);
00334
00336
00340 void makeTrans(const fk_Vector &v);
00341
00343
00350 void makeEuler(double h, double p, double b);
00351
00353
00358 void makeEuler(const fk_Angle &angle);
00359
00360
00361 #ifndef FK_DOXYGEN_USER_PROCESS
00362
00363 void Print(std::string = "") const;
00364
00365 #endif
00366
00368
00369 friend fk_HVector operator *(const fk_OrthoMatrix &,
00370 const fk_HVector &);
00371 friend fk_OrthoMatrix operator *(const fk_OrthoMatrix &,
00372 const fk_OrthoMatrix &);
00373 friend fk_Matrix operator *(const fk_Matrix &, const fk_OrthoMatrix &);
00374 friend fk_Matrix operator *(const fk_OrthoMatrix &, const fk_Matrix &);
00375 friend fk_Matrix operator +(const fk_Matrix &, const fk_OrthoMatrix &);
00376 friend fk_Matrix operator +(const fk_OrthoMatrix &, const fk_Matrix &);
00377 friend fk_Matrix operator -(const fk_Matrix &, const fk_OrthoMatrix &);
00378 friend fk_Matrix operator -(const fk_OrthoMatrix &, const fk_Matrix &);
00379
00380 };
00381
00382
00384
00396 fk_HVector operator *(const fk_OrthoMatrix &,
00397 const fk_HVector &);
00399
00413 fk_OrthoMatrix operator *(const fk_OrthoMatrix &,
00414 const fk_OrthoMatrix &);
00415
00417
00431 fk_Matrix operator *(const fk_Matrix &, const fk_OrthoMatrix &);
00432
00434
00448 fk_Matrix operator *(const fk_OrthoMatrix &, const fk_Matrix &);
00449
00451
00463 fk_Matrix operator +(const fk_Matrix &, const fk_OrthoMatrix &);
00464
00466
00478 fk_Matrix operator +(const fk_OrthoMatrix &, const fk_Matrix &);
00479
00481
00493 fk_Matrix operator -(const fk_Matrix &, const fk_OrthoMatrix &);
00494
00496
00508 fk_Matrix operator -(const fk_OrthoMatrix &, const fk_Matrix &);
00509
00510
00511
00513
00524 class fk_Matrix : public fk_OrthoMatrix {
00525
00526 friend class fk_Vector;
00527 friend class fk_HVector;
00528
00529 public:
00530
00532
00535 fk_Matrix(void);
00536
00538 fk_Matrix(const fk_Matrix &);
00539
00541
00543
00553 fk_Matrix operator !(void) const;
00554
00555
00556
00558
00560
00574 bool operator ==(const fk_Matrix &) const;
00575
00577
00591 bool operator !=(const fk_Matrix &) const;
00592
00593
00594
00596
00597
00599 fk_Matrix & operator =(const fk_Matrix &);
00600
00602 fk_Matrix & operator =(const fk_OrthoMatrix &);
00603
00605
00619 fk_Matrix & operator +=(const fk_Matrix &);
00620
00622
00626 fk_Matrix & operator +=(const fk_OrthoMatrix &);
00627
00629
00643 fk_Matrix & operator -=(const fk_Matrix &);
00644
00646
00650 fk_Matrix & operator -=(const fk_OrthoMatrix &);
00651
00653
00672 fk_Matrix & operator *=(const fk_Matrix &);
00673
00675
00679 fk_Matrix & operator *=(const fk_OrthoMatrix &);
00680
00681
00682
00684
00685
00687
00693 bool isRegular(void) const;
00694
00696
00703 bool isSingular(void) const;
00704
00706
00713 bool inverse(void);
00714
00716
00722 void makeScale(double x, double y, double z);
00723
00725
00730 void makeScale(const fk_Vector &v);
00731
00732
00733
00735
00736 friend fk_HVector operator *(const fk_Matrix &, const fk_HVector &);
00737 friend fk_Matrix operator *(const fk_Matrix &, const fk_Matrix &);
00738 friend fk_Matrix operator +(const fk_Matrix &, const fk_Matrix &);
00739 friend fk_Matrix operator -(const fk_Matrix &, const fk_Matrix &);
00740
00741 };
00742
00744
00756 fk_HVector operator *(const fk_Matrix &, const fk_HVector &);
00757
00759
00773 fk_Matrix operator *(const fk_Matrix &, const fk_Matrix &);
00774
00776
00788 fk_Matrix operator +(const fk_Matrix &, const fk_Matrix &);
00789
00791
00803 fk_Matrix operator -(const fk_Matrix &, const fk_Matrix &);
00804
00805
00806 #endif