ScummVM API documentation
fmatrix.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef TITANIC_FMATRIX_H
23 #define TITANIC_FMATRIX_H
24 
25 #include "titanic/star_control/fvector.h"
26 
27 namespace Titanic {
28 
29 class SimpleFile;
30 
35 class FMatrix {
36 public:
37  FVector _row1;
38  FVector _row2;
39  FVector _row3;
40 public:
41  FMatrix();
42  FMatrix(const FVector &, const FVector &, const FVector &);
43 
47  void load(SimpleFile *file, int param);
48 
52  void save(SimpleFile *file, int indent);
53 
57  void clear();
58 
62  void identity();
63 
67  void set(const FMatrix &m);
68 
72  void set(const FVector &row1, const FVector &row2, const FVector &row3);
73 
77  void set(const FVector &v);
78 
83  void matRProd(const FMatrix &m);
84 
89  void matLProd(const FMatrix &m);
90 
94  bool operator==(const FMatrix &src) {
95  return _row1 == src._row1 && _row2 == src._row2 && _row3 == src._row3;
96  }
97 
101  bool operator!=(const FMatrix &src) {
102  return !operator==(src);
103  }
104 
108  FVector &operator[](int idx) {
109  assert(idx >= 0 && idx <= 2);
110  FVector *rows[3] = { &_row1, &_row2, &_row3 };
111  return *rows[idx];
112  }
113 };
114 
120 void matProd(const FMatrix &a, const FMatrix &m, FMatrix &C);
121 
122 } // End of namespace Titanic
123 
124 #endif /* TITANIC_FMATRIX_H */
Definition: fmatrix.h:35
void matLProd(const FMatrix &m)
Definition: simple_file.h:49
void save(SimpleFile *file, int indent)
FVector & operator[](int idx)
Definition: fmatrix.h:108
Definition: arm.h:30
bool operator!=(const FMatrix &src)
Definition: fmatrix.h:101
void matRProd(const FMatrix &m)
bool operator==(const FMatrix &src)
Definition: fmatrix.h:94
Definition: fvector.h:36
void load(SimpleFile *file, int param)