@@ -1033,40 +1033,40 @@ class Mat2 : public MatBase<T, 2, 2> {
1033
1033
template <typename Source>
1034
1034
__hostdev__ Mat2 (Source* array) : Base(array) {}
1035
1035
1036
- __hostdev__ Mat2 operator -() const { return Mat2 (-this [0 ][0 ], -this [0 ][1 ], -this [1 ][0 ], -this [1 ][1 ]); }
1036
+ __hostdev__ Mat2 operator -() const { return Mat2 (-(* this ) [0 ][0 ], -(* this ) [0 ][1 ], -(* this ) [1 ][0 ], -(* this ) [1 ][1 ]); }
1037
1037
1038
1038
// / @brief Multiply by 2x2 matrix @a m and return the resulting matrix.
1039
1039
__hostdev__ Mat2<T> operator *(const Mat2<T>& m) const {
1040
1040
return Mat2<T>(
1041
- this [0 ][0 ] * m[0 ][0 ] + this [0 ][1 ] * m[1 ][0 ],
1042
- this [0 ][0 ] * m[0 ][1 ] + this [0 ][1 ] * m[1 ][1 ],
1043
- this [1 ][0 ] * m[0 ][0 ] + this [1 ][1 ] * m[1 ][0 ],
1044
- this [1 ][0 ] * m[0 ][1 ] + this [1 ][1 ] * m[1 ][1 ]
1041
+ (* this ) [0 ][0 ] * m[0 ][0 ] + (* this ) [0 ][1 ] * m[1 ][0 ],
1042
+ (* this ) [0 ][0 ] * m[0 ][1 ] + (* this ) [0 ][1 ] * m[1 ][1 ],
1043
+ (* this ) [1 ][0 ] * m[0 ][0 ] + (* this ) [1 ][1 ] * m[1 ][0 ],
1044
+ (* this ) [1 ][0 ] * m[0 ][1 ] + (* this ) [1 ][1 ] * m[1 ][1 ]
1045
1045
);
1046
1046
}
1047
1047
1048
1048
// / @brief Add each element of the given matrix to the corresponding element of this matrix.
1049
1049
__hostdev__ Mat2<T>& operator +=(const Mat2<T>& m) {
1050
- this [0 ][0 ] += m[0 ][0 ];
1051
- this [0 ][1 ] += m[0 ][1 ];
1052
- this [1 ][0 ] += m[1 ][0 ];
1053
- this [1 ][1 ] += m[1 ][1 ];
1050
+ (* this ) [0 ][0 ] += m[0 ][0 ];
1051
+ (* this ) [0 ][1 ] += m[0 ][1 ];
1052
+ (* this ) [1 ][0 ] += m[1 ][0 ];
1053
+ (* this ) [1 ][1 ] += m[1 ][1 ];
1054
1054
return *this ;
1055
1055
}
1056
1056
1057
1057
// / @brief returns transpose of this
1058
1058
__hostdev__ Mat2<T> transpose () const {
1059
- return Mat2<T>(this [0 ][0 ], this [1 ][0 ], this [0 ][1 ], this [1 ][1 ]);
1059
+ return Mat2<T>((* this ) [0 ][0 ], (* this ) [1 ][0 ], (* this ) [0 ][1 ], (* this ) [1 ][1 ]);
1060
1060
}
1061
1061
1062
1062
// / @brief returns inverse of this
1063
1063
__hostdev__ Mat2<T> inverse () const {
1064
- T det = this [0 ][0 ] * this [1 ][1 ] - this [0 ][1 ] * this [1 ][0 ];
1064
+ T det = (* this ) [0 ][0 ] * (* this ) [1 ][1 ] - (* this ) [0 ][1 ] * (* this ) [1 ][0 ];
1065
1065
if (isApproxZero (det)) {
1066
1066
return Mat2<T>();
1067
1067
}
1068
1068
T invDet = 1 .f / det;
1069
- return Mat2<T>(this [1 ][1 ] * invDet, -this [0 ][1 ] * invDet, -this [1 ][0 ] * invDet, this [0 ][0 ] * invDet);
1069
+ return Mat2<T>((* this ) [1 ][1 ] * invDet, -(* this ) [0 ][1 ] * invDet, -(* this ) [1 ][0 ] * invDet, (* this ) [0 ][0 ] * invDet);
1070
1070
}
1071
1071
};
1072
1072
@@ -1093,24 +1093,24 @@ class Mat2x3 : public MatBase<T, 2, 3> {
1093
1093
// / @brief Add two matrices and return the resulting matrix.
1094
1094
__hostdev__ Mat2x3<T> operator +(const Mat2x3<T>& m) const {
1095
1095
return Mat2x3<T>(
1096
- this [0 ][0 ] + m[0 ][0 ], this [0 ][1 ] + m[0 ][1 ], this [0 ][2 ] + m[0 ][2 ],
1097
- this [1 ][0 ] + m[1 ][0 ], this [1 ][1 ] + m[1 ][1 ], this [1 ][2 ] + m[1 ][2 ]
1096
+ (* this ) [0 ][0 ] + m[0 ][0 ], (* this ) [0 ][1 ] + m[0 ][1 ], (* this ) [0 ][2 ] + m[0 ][2 ],
1097
+ (* this ) [1 ][0 ] + m[1 ][0 ], (* this ) [1 ][1 ] + m[1 ][1 ], (* this ) [1 ][2 ] + m[1 ][2 ]
1098
1098
);
1099
1099
}
1100
1100
1101
1101
// / @brief Add a 2x3 matrix to this matrix.
1102
1102
__hostdev__ Mat2x3<T>& operator +=(const Mat2x3<T>& m) {
1103
- this [0 ][0 ] += m[0 ][0 ]; this [0 ][1 ] += m[0 ][1 ]; this [0 ][2 ] += m[0 ][2 ];
1104
- this [1 ][0 ] += m[1 ][0 ]; this [1 ][1 ] += m[1 ][1 ]; this [1 ][2 ] += m[1 ][2 ];
1103
+ (* this ) [0 ][0 ] += m[0 ][0 ]; (* this ) [0 ][1 ] += m[0 ][1 ]; (* this ) [0 ][2 ] += m[0 ][2 ];
1104
+ (* this ) [1 ][0 ] += m[1 ][0 ]; (* this ) [1 ][1 ] += m[1 ][1 ]; (* this ) [1 ][2 ] += m[1 ][2 ];
1105
1105
return *this ;
1106
1106
}
1107
1107
1108
1108
// / @brief returns transpose of this
1109
1109
__hostdev__ Mat3x2<T> transpose () const {
1110
1110
return Mat3x2<T>(
1111
- this [0 ][0 ], this [1 ][0 ], // First row
1112
- this [0 ][1 ], this [1 ][1 ], // Second row
1113
- this [0 ][2 ], this [1 ][2 ] // Third row
1111
+ (* this ) [0 ][0 ], (* this ) [1 ][0 ], // First row
1112
+ (* this ) [0 ][1 ], (* this ) [1 ][1 ], // Second row
1113
+ (* this ) [0 ][2 ], (* this ) [1 ][2 ] // Third row
1114
1114
);
1115
1115
}
1116
1116
};
@@ -1141,8 +1141,8 @@ class Mat3x2: public MatBase<T, 3, 2> {
1141
1141
1142
1142
// / @brief returns transpose of this
1143
1143
__hostdev__ Mat2x3<T> transpose () const {
1144
- return Mat2x3<T>(this [0 ][0 ], this [1 ][0 ], this [2 ][0 ], // First row
1145
- this [0 ][1 ], this [1 ][1 ], this [2 ][1 ]); // Second row
1144
+ return Mat2x3<T>((* this ) [0 ][0 ], (* this ) [1 ][0 ], (* this ) [2 ][0 ], // First row
1145
+ (* this ) [0 ][1 ], (* this ) [1 ][1 ], (* this ) [2 ][1 ]); // Second row
1146
1146
}
1147
1147
1148
1148
};
@@ -1177,49 +1177,49 @@ class Mat3 : public MatBase<T, 3, 3> {
1177
1177
// / @brief Add two matrices and return the resulting matrix.
1178
1178
__hostdev__ Mat3<T> operator +(const Mat3<T>& m) const {
1179
1179
return Mat3<T>(
1180
- this [0 ][0 ] + m[0 ][0 ], this [0 ][1 ] + m[0 ][1 ], this [0 ][2 ] + m[0 ][2 ],
1181
- this [1 ][0 ] + m[1 ][0 ], this [1 ][1 ] + m[1 ][1 ], this [1 ][2 ] + m[1 ][2 ],
1182
- this [2 ][0 ] + m[2 ][0 ], this [2 ][1 ] + m[2 ][1 ], this [2 ][2 ] + m[2 ][2 ]
1180
+ (* this ) [0 ][0 ] + m[0 ][0 ], (* this ) [0 ][1 ] + m[0 ][1 ], (* this ) [0 ][2 ] + m[0 ][2 ],
1181
+ (* this ) [1 ][0 ] + m[1 ][0 ], (* this ) [1 ][1 ] + m[1 ][1 ], (* this ) [1 ][2 ] + m[1 ][2 ],
1182
+ (* this ) [2 ][0 ] + m[2 ][0 ], (* this ) [2 ][1 ] + m[2 ][1 ], (* this ) [2 ][2 ] + m[2 ][2 ]
1183
1183
);
1184
1184
}
1185
1185
1186
1186
// / @brief Multiply by @a v and return the resulting vector.
1187
1187
__hostdev__ Vec3<T> operator *(const Vec3<T>& v) const {
1188
1188
return Vec3<T>(
1189
- this [0 ][0 ] * v[0 ] + this [0 ][1 ] * v[1 ] + this [0 ][2 ] * v[2 ],
1190
- this [1 ][0 ] * v[0 ] + this [1 ][1 ] * v[1 ] + this [1 ][2 ] * v[2 ],
1191
- this [2 ][0 ] * v[0 ] + this [2 ][1 ] * v[1 ] + this [2 ][2 ] * v[2 ]
1189
+ (* this ) [0 ][0 ] * v[0 ] + (* this ) [0 ][1 ] * v[1 ] + (* this ) [0 ][2 ] * v[2 ],
1190
+ (* this ) [1 ][0 ] * v[0 ] + (* this ) [1 ][1 ] * v[1 ] + (* this ) [1 ][2 ] * v[2 ],
1191
+ (* this ) [2 ][0 ] * v[0 ] + (* this ) [2 ][1 ] * v[1 ] + (* this ) [2 ][2 ] * v[2 ]
1192
1192
);
1193
1193
}
1194
1194
1195
1195
// / @brief Multiply by 3x3 matrix @a m and return the resulting matrix.
1196
1196
__hostdev__ Mat3<T> operator *(const Mat3<T>& m) const {
1197
1197
return Mat3<T>(
1198
- this [0 ][0 ] * m[0 ][0 ] + this [0 ][1 ] * m[1 ][0 ] + this [0 ][2 ] * m[2 ][0 ],
1199
- this [0 ][0 ] * m[0 ][1 ] + this [0 ][1 ] * m[1 ][1 ] + this [0 ][2 ] * m[2 ][1 ],
1200
- this [0 ][0 ] * m[0 ][2 ] + this [0 ][1 ] * m[1 ][2 ] + this [0 ][2 ] * m[2 ][2 ],
1201
- this [1 ][0 ] * m[0 ][0 ] + this [1 ][1 ] * m[1 ][0 ] + this [1 ][2 ] * m[2 ][0 ],
1202
- this [1 ][0 ] * m[0 ][1 ] + this [1 ][1 ] * m[1 ][1 ] + this [1 ][2 ] * m[2 ][1 ],
1203
- this [1 ][0 ] * m[0 ][2 ] + this [1 ][1 ] * m[1 ][2 ] + this [1 ][2 ] * m[2 ][2 ],
1204
- this [2 ][0 ] * m[0 ][0 ] + this [2 ][1 ] * m[1 ][0 ] + this [2 ][2 ] * m[2 ][0 ],
1205
- this [2 ][0 ] * m[0 ][1 ] + this [2 ][1 ] * m[1 ][1 ] + this [2 ][2 ] * m[2 ][1 ],
1206
- this [2 ][0 ] * m[0 ][2 ] + this [2 ][1 ] * m[1 ][2 ] + this [2 ][2 ] * m[2 ][2 ]
1198
+ (* this ) [0 ][0 ] * m[0 ][0 ] + (* this ) [0 ][1 ] * m[1 ][0 ] + (* this ) [0 ][2 ] * m[2 ][0 ],
1199
+ (* this ) [0 ][0 ] * m[0 ][1 ] + (* this ) [0 ][1 ] * m[1 ][1 ] + (* this ) [0 ][2 ] * m[2 ][1 ],
1200
+ (* this ) [0 ][0 ] * m[0 ][2 ] + (* this ) [0 ][1 ] * m[1 ][2 ] + (* this ) [0 ][2 ] * m[2 ][2 ],
1201
+ (* this ) [1 ][0 ] * m[0 ][0 ] + (* this ) [1 ][1 ] * m[1 ][0 ] + (* this ) [1 ][2 ] * m[2 ][0 ],
1202
+ (* this ) [1 ][0 ] * m[0 ][1 ] + (* this ) [1 ][1 ] * m[1 ][1 ] + (* this ) [1 ][2 ] * m[2 ][1 ],
1203
+ (* this ) [1 ][0 ] * m[0 ][2 ] + (* this ) [1 ][1 ] * m[1 ][2 ] + (* this ) [1 ][2 ] * m[2 ][2 ],
1204
+ (* this ) [2 ][0 ] * m[0 ][0 ] + (* this ) [2 ][1 ] * m[1 ][0 ] + (* this ) [2 ][2 ] * m[2 ][0 ],
1205
+ (* this ) [2 ][0 ] * m[0 ][1 ] + (* this ) [2 ][1 ] * m[1 ][1 ] + (* this ) [2 ][2 ] * m[2 ][1 ],
1206
+ (* this ) [2 ][0 ] * m[0 ][2 ] + (* this ) [2 ][1 ] * m[1 ][2 ] + (* this ) [2 ][2 ] * m[2 ][2 ]
1207
1207
);
1208
1208
}
1209
1209
1210
1210
// / @brief Add each element of the given matrix to the corresponding element of this matrix.
1211
1211
__hostdev__ Mat3<T>& operator +=(const Mat3<T>& m) {
1212
- this [0 ][0 ] += m[0 ][0 ]; this [0 ][1 ] += m[0 ][1 ]; this [0 ][2 ] += m[0 ][2 ];
1213
- this [1 ][0 ] += m[1 ][0 ]; this [1 ][1 ] += m[1 ][1 ]; this [1 ][2 ] += m[1 ][2 ];
1214
- this [2 ][0 ] += m[2 ][0 ]; this [2 ][1 ] += m[2 ][1 ]; this [2 ][2 ] += m[2 ][2 ];
1212
+ (* this ) [0 ][0 ] += m[0 ][0 ]; (* this ) [0 ][1 ] += m[0 ][1 ]; (* this ) [0 ][2 ] += m[0 ][2 ];
1213
+ (* this ) [1 ][0 ] += m[1 ][0 ]; (* this ) [1 ][1 ] += m[1 ][1 ]; (* this ) [1 ][2 ] += m[1 ][2 ];
1214
+ (* this ) [2 ][0 ] += m[2 ][0 ]; (* this ) [2 ][1 ] += m[2 ][1 ]; (* this ) [2 ][2 ] += m[2 ][2 ];
1215
1215
return *this ;
1216
1216
}
1217
1217
1218
1218
// / @brief returns transpose of this
1219
1219
__hostdev__ Mat3 transpose () const {
1220
- return Mat3 (this [0 ][0 ], this [1 ][0 ], this [2 ][0 ],
1221
- this [0 ][1 ], this [1 ][1 ], this [2 ][1 ],
1222
- this [0 ][2 ], this [1 ][2 ], this [2 ][2 ]);
1220
+ return Mat3 ((* this ) [0 ][0 ], (* this ) [1 ][0 ], (* this ) [2 ][0 ],
1221
+ (* this ) [0 ][1 ], (* this ) [1 ][1 ], (* this ) [2 ][1 ],
1222
+ (* this ) [0 ][2 ], (* this ) [1 ][2 ], (* this ) [2 ][2 ]);
1223
1223
}
1224
1224
};
1225
1225
@@ -1254,10 +1254,10 @@ class Mat4 : public MatBase<T, 4, 4> {
1254
1254
1255
1255
// / @brief returns transpose of this
1256
1256
__hostdev__ Mat4 transpose () const {
1257
- return Mat4 (this [0 ][0 ], this [1 ][0 ], this [2 ][0 ], this [3 ][0 ],
1258
- this [0 ][1 ], this [1 ][1 ], this [2 ][1 ], this [3 ][1 ],
1259
- this [0 ][2 ], this [1 ][2 ], this [2 ][2 ], this [3 ][2 ],
1260
- this [0 ][3 ], this [1 ][3 ], this [2 ][3 ], this [3 ][3 ]);
1257
+ return Mat4 ((* this ) [0 ][0 ], (* this ) [1 ][0 ], (* this ) [2 ][0 ], (* this ) [3 ][0 ],
1258
+ (* this ) [0 ][1 ], (* this ) [1 ][1 ], (* this ) [2 ][1 ], (* this ) [3 ][1 ],
1259
+ (* this ) [0 ][2 ], (* this ) [1 ][2 ], (* this ) [2 ][2 ], (* this ) [3 ][2 ],
1260
+ (* this ) [0 ][3 ], (* this ) [1 ][3 ], (* this ) [2 ][3 ], (* this ) [3 ][3 ]);
1261
1261
}
1262
1262
};
1263
1263
0 commit comments