aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/star_control/daffine.cpp7
-rw-r--r--engines/titanic/star_control/daffine.h21
-rw-r--r--engines/titanic/star_control/dvector.cpp6
3 files changed, 18 insertions, 16 deletions
diff --git a/engines/titanic/star_control/daffine.cpp b/engines/titanic/star_control/daffine.cpp
index 8c956da9dd..6dfee29b32 100644
--- a/engines/titanic/star_control/daffine.cpp
+++ b/engines/titanic/star_control/daffine.cpp
@@ -65,7 +65,7 @@ DAffine::DAffine(const FMatrix &src) {
_col3 = src._row3;
}
-//TODO: What is _static_ for?
+//TODO: What is _static for?
void DAffine::init() {
_static = nullptr;
}
@@ -90,6 +90,7 @@ void DAffine::clear() {
_col4._z = 0.0;
}
+// Source: https://en.wikipedia.org/wiki/Rotation_matrix
void DAffine::setRotationMatrix(Axis axis, double angleDeg) {
clear();
@@ -107,9 +108,9 @@ void DAffine::setRotationMatrix(Axis axis, double angleDeg) {
case Y_AXIS:
_col1._x = cosVal;
- _col1._z = sinVal;
+ _col1._z = -sinVal;
_col2._y = 1.0;
- _col3._x = -sinVal;
+ _col3._x = sinVal;
_col3._z = cosVal;
break;
diff --git a/engines/titanic/star_control/daffine.h b/engines/titanic/star_control/daffine.h
index dda87323c6..631b6003f0 100644
--- a/engines/titanic/star_control/daffine.h
+++ b/engines/titanic/star_control/daffine.h
@@ -50,6 +50,7 @@ public:
static void deinit();
public:
DAffine();
+ //TODO: consider making mode an enum since that is more helpful when it is used in code
DAffine(int mode, const DVector &src);
DAffine(Axis axis, double angleDeg);
DAffine(const FMatrix &src);
@@ -69,18 +70,18 @@ public:
*/
DAffine inverseTransform() const;
- /**
- * Change this Daffine to have its first three columns be some mapping from src matrix
- * and the 4rth column to be (three) zeros. The mapping is not as simple as replacing
- * matching row/colmn indices
- */
+ /**
+ * Change this Daffine to have its first three columns be some mapping from src matrix
+ * and the 4rth column to be (three) zeros. The mapping is not as simple as replacing
+ * matching row/colmn indices
+ */
void loadTransform(const CMatrixTransform &src);
- /**
- * Do the affine product between this Daffine on the left
- * and the m Daffine matrix on the right. This is product is NOT the same
- * as multiplying two matrices of dimensions 4x4.
- */
+ /**
+ * Do the affine product between this Daffine on the right
+ * and the m Daffine matrix on the left. This product is NOT the same
+ * as multiplying two matrices of dimensions 3x4.
+ */
DAffine compose(const DAffine &m);
};
diff --git a/engines/titanic/star_control/dvector.cpp b/engines/titanic/star_control/dvector.cpp
index 9f35ff6b67..c7481a2b49 100644
--- a/engines/titanic/star_control/dvector.cpp
+++ b/engines/titanic/star_control/dvector.cpp
@@ -86,13 +86,13 @@ DAffine DVector::getFrameTransform(const DVector &v) {
DVector vector1 = getAnglesAsVect();
matrix1.setRotationMatrix(X_AXIS, vector1._y * Rad2Deg);
- matrix2.setRotationMatrix(Y_AXIS, -(vector1._z * Rad2Deg));
+ matrix2.setRotationMatrix(Y_AXIS, vector1._z * Rad2Deg);
matrix3 = matrix1.compose(matrix2);
matrix4 = matrix3.inverseTransform();
vector1 = v.getAnglesAsVect();
matrix1.setRotationMatrix(X_AXIS, vector1._y * Rad2Deg);
- matrix2.setRotationMatrix(Y_AXIS, -(vector1._z * Rad2Deg));
+ matrix2.setRotationMatrix(Y_AXIS, vector1._z * Rad2Deg);
matrix3 = matrix1.compose(matrix2);
return matrix4.compose(matrix3);
@@ -102,7 +102,7 @@ DAffine DVector::rotXY() const {
DVector v1 = getAnglesAsVect();
DAffine m1, m2;
m1.setRotationMatrix(X_AXIS, v1._y * Rad2Deg);
- m2.setRotationMatrix(Y_AXIS, -(v1._z * Rad2Deg));
+ m2.setRotationMatrix(Y_AXIS, v1._z * Rad2Deg);
return m1.compose(m2);
}