13 for (
int row=0; row<3; ++row) {
14 m_Matrix[row][0]=c1(row);
15 m_Matrix[row][1]=c2(row);
16 m_Matrix[row][2]=c3(row);
37 return m_Matrix[row][col];
43 return m_Matrix[row][col];
50 for (
int row = 0; row < 3; ++row) {
51 for (
int col = 0; col < 3; ++col) {
61 for (
int row = 0; row < 3; ++row) {
62 for (
int col = 0; col < 3; ++col) {
63 m_Matrix[row][col] += mat.
m_Matrix[row][col];
73 for (
int row = 0; row < 3; ++row) {
74 for (
int col = 0; col < 3; ++col) {
85 for (
int row = 0; row < 3; ++row) {
86 for (
int col = 0; col < 3; ++col) {
87 m_Matrix[row][col] -= mat.
m_Matrix[row][col];
98 for (
int row = 0; row < 3; ++row) {
99 for (
int col = 0; col < 3; ++col) {
101 for (
int j = 0; j < 3; ++j) {
102 sum += m_Matrix[row][j] * mat.
m_Matrix[j][col];
110 template <
typename T>
114 for (
int row = 0; row < 3; ++row) {
116 for (
int j = 0; j < 3; ++j) {
117 sum += m_Matrix[row][j] * vec(j);
124 template <
typename T>
127 for (
int row = 0; row < 3; ++row) {
128 for (
int col = 0; col < 3; ++col) {
129 if (m_Matrix[row][col] != mat.
m_Matrix[row][col]) {
138 template <
typename T>
141 for (
int row = 0; row < 3; ++row) {
142 for (
int col = 0; col < 3; ++col) {
143 if (m_Matrix[row][col] != mat.
m_Matrix[row][col]) {
152 template <
typename T>
155 for (
int col = 0; col < 3; ++col) {
156 for (
int row = 0; row < 3; ++row) {
158 m_Matrix[row][col] = 1.0f;
160 m_Matrix[row][col] = 0.0f;
166 template <
typename T>
180 return a*(e*k - f*h) + b*(f*g - d*k) + c*(d*h - e*g);
183 template <
typename T>
187 double det = determinant();
201 inv.
m_Matrix[0][0] = (e*k - f*h)/det;
202 inv.
m_Matrix[1][0] =-(b*k - c*h)/det;
203 inv.
m_Matrix[2][0] = (b*f - c*e)/det;
205 inv.
m_Matrix[0][1] =-(d*k - f*g)/det;
206 inv.
m_Matrix[1][1] = (a*k - c*g)/det;
207 inv.
m_Matrix[2][1] =-(a*f - c*d)/det;
209 inv.
m_Matrix[0][2] = (d*h - e*g)/det;
210 inv.
m_Matrix[1][2] =-(a*h - b*g)/det;
211 inv.
m_Matrix[2][2] = (a*e - b*d)/det;
225 template <
typename T>
230 for (
int i=0; i<3; i++) {
231 for (
int j=0; j<3; j++) {
232 tr(j,i) = operator() (i,j);
239 template <
typename T>
249 template <
typename T>
264 template <
typename T>
279 template <
typename T>
294 template <
typename T>
300 template <
typename T>
306 template <
typename T>
309 settings->beginGroup(name);
311 for (
int r=0; r<3; r++) {
312 for (
int c=0; c<3; c++) {
313 settings->setValue(QString(
"r%1c%2").arg(r).arg(c),
operator()(r,c));
317 settings->endGroup();
static CctwMatrix3x3 rotZ(double r)
T & operator()(int row, int col)
static CctwMatrix3x3 rotX(double r)
CctwMatrix3x3 operator-=(const CctwMatrix3x3 &mat)
static CctwMatrix3x3 rotY(double r)
static CctwMatrix3x3 rotationMatrix(double r1, double r2, double r3)
double determinant() const
static void customSaver(const QVariant &val, QSettings *settings, QString name)
CctwMatrix3x3 operator+(const CctwMatrix3x3 &mat) const
CctwMatrix3x3 operator*(const CctwMatrix3x3 &mat) const
CctwMatrix3x3 operator-(const CctwMatrix3x3 &mat) const
CctwMatrix3x3 transposed() const
CctwMatrix3x3 inverted(bool *invertible=NULL) const
bool operator==(const CctwMatrix3x3 &mat) const
static CctwMatrix3x3 identity()
static CctwMatrix3x3 zero()
void setSettingsValue(QSettings *settings, QString name)
CctwMatrix3x3 operator+=(const CctwMatrix3x3 &mat)
bool operator!=(const CctwMatrix3x3 &mat) const