TITANIC: Minor cleanup and warning fixes to star control

This commit is contained in:
Paul Gilbert 2017-09-02 11:20:17 -04:00
parent 2518de30a4
commit ba84efe497
5 changed files with 25 additions and 25 deletions

View file

@ -91,7 +91,7 @@ void FPose::identity() {
// Source: https://en.wikipedia.org/wiki/Rotation_matrix // Source: https://en.wikipedia.org/wiki/Rotation_matrix
void FPose::setRotationMatrix(Axis axis, float amount) { void FPose::setRotationMatrix(Axis axis, float amount) {
const float ROTATION = 2 * M_PI / 360.0; const float ROTATION = (float)(2 * M_PI / 360.0);
float sinVal = sin(amount * ROTATION); float sinVal = sin(amount * ROTATION);
float cosVal = cos(amount * ROTATION); float cosVal = cos(amount * ROTATION);
@ -230,10 +230,10 @@ FPose FPose::compose(const FMatrix &m) {
FPose FPose::compose2(const FPose &m) { FPose FPose::compose2(const FPose &m) {
FPose dm; FPose dm;
dm._row1 = _row1.MatProdRowVect(m); dm._row1 = _row1.matProdRowVect(m);
dm._row2 = _row2.MatProdRowVect(m); dm._row2 = _row2.matProdRowVect(m);
dm._row3 = _row3.MatProdRowVect(m); dm._row3 = _row3.matProdRowVect(m);
dm._vector = _vector.MatProdRowVect(m); dm._vector = _vector.matProdRowVect(m);
return dm; return dm;
} }

View file

@ -103,7 +103,7 @@ float FVector::getDistance(const FVector &src) const {
return sqrt(xd * xd + yd * yd + zd * zd); return sqrt(xd * xd + yd * yd + zd * zd);
} }
FVector FVector::MatProdRowVect(const FPose &pose) const { FVector FVector::matProdRowVect(const FPose &pose) const {
FVector v; FVector v;
v._x = pose._row2._x * _y + pose._row3._x * _z + pose._row1._x * _x + pose._vector._x; v._x = pose._row2._x * _y + pose._row3._x * _z + pose._row1._x * _x + pose._vector._x;
v._y = pose._row2._y * _y + pose._row3._y * _z + pose._row1._y * _x + pose._vector._y; v._y = pose._row2._y * _y + pose._row3._y * _z + pose._row1._y * _x + pose._vector._y;

View file

@ -101,7 +101,7 @@ public:
* Returns a vector that is this vector on the left as a row vector * Returns a vector that is this vector on the left as a row vector
* times the 3x4 affine matrix on the right. * times the 3x4 affine matrix on the right.
*/ */
FVector MatProdRowVect(const FPose &pose) const; FVector matProdRowVect(const FPose &pose) const;
/** /**
* Returns a matrix that contains the frame rotation based on this vector and * Returns a matrix that contains the frame rotation based on this vector and

View file

@ -291,10 +291,10 @@ void CStarCamera::setViewportAngle(const FPoint &angles) {
tempV5 -= row1; tempV5 -= row1;
tempV6 -= row1; tempV6 -= row1;
tempV1 = tempV1.MatProdRowVect(pose); tempV1 = tempV1.matProdRowVect(pose);
tempV4 = tempV4.MatProdRowVect(pose); tempV4 = tempV4.matProdRowVect(pose);
tempV5 = tempV5.MatProdRowVect(pose); tempV5 = tempV5.matProdRowVect(pose);
tempV6 = tempV6.MatProdRowVect(pose); tempV6 = tempV6.matProdRowVect(pose);
tempV4 -= tempV1; tempV4 -= tempV1;
tempV5 -= tempV1; tempV5 -= tempV1;
@ -362,15 +362,15 @@ void CStarCamera::setViewportAngle(const FPoint &angles) {
tempV7._x = m3._row3._x * rowScale2 + tempV3._x; tempV7._x = m3._row3._x * rowScale2 + tempV3._x;
mrow3 = tempV7; mrow3 = tempV7;
tempV3 = tempV3.MatProdRowVect(m12); tempV3 = tempV3.matProdRowVect(m12);
mrow1 = mrow1.MatProdRowVect(m12); mrow1 = mrow1.matProdRowVect(m12);
mrow2 = mrow2.MatProdRowVect(m12); mrow2 = mrow2.matProdRowVect(m12);
mrow3 = mrow3.MatProdRowVect(m12); mrow3 = mrow3.matProdRowVect(m12);
tempV3 = tempV3.MatProdRowVect(m11); tempV3 = tempV3.matProdRowVect(m11);
mrow1 = mrow1.MatProdRowVect(m11); mrow1 = mrow1.matProdRowVect(m11);
mrow2 = mrow2.MatProdRowVect(m11); mrow2 = mrow2.matProdRowVect(m11);
mrow3 = mrow3.MatProdRowVect(m11); mrow3 = mrow3.matProdRowVect(m11);
mrow1 -= tempV3; mrow1 -= tempV3;
mrow2 -= tempV3; mrow2 -= tempV3;
@ -563,7 +563,7 @@ bool CStarCamera::lockMarker2(CViewport *viewport, const FVector &secondStarPosi
m4._vector = tempV3; m4._vector = tempV3;
FVector viewPosition2 = oldPos.MatProdRowVect(m10); FVector viewPosition2 = oldPos.matProdRowVect(m10);
m3 = m4.compose2(m10); m3 = m4.compose2(m10);
float minDistance; float minDistance;
@ -627,7 +627,7 @@ bool CStarCamera::lockMarker3(CViewport *viewport, const FVector &thirdStarPosit
float CStarCamera::calcAngleForMinDist(FVector &x, FVector &y, float &minDistance) { float CStarCamera::calcAngleForMinDist(FVector &x, FVector &y, float &minDistance) {
FVector tempPos; FVector tempPos;
minDistance = 1.0e20; minDistance = (float)1.0e20;
float minDegree = 0.0; float minDegree = 0.0;
float degInc = 1.0; // one degree steps float degInc = 1.0; // one degree steps
int nDegrees = floor(360.0/degInc); int nDegrees = floor(360.0/degInc);

View file

@ -127,7 +127,7 @@ void CViewport::setPosition(const FVector &v) {
} }
void CViewport::setPosition(const FPose &pose) { void CViewport::setPosition(const FPose &pose) {
_position = _position.MatProdRowVect(pose); _position = _position.matProdRowVect(pose);
_poseUpToDate = false; _poseUpToDate = false;
} }
@ -233,14 +233,14 @@ FPose CViewport::getRawPose() {
// 2 which corresponds to _isZero which has value 0. // 2 which corresponds to _isZero which has value 0.
FVector CViewport::getRelativePosNoCentering(int index, const FVector &src) { FVector CViewport::getRelativePosNoCentering(int index, const FVector &src) {
FPose current_pose = getPose(); FPose current_pose = getPose();
FVector dest = src.MatProdRowVect(current_pose); FVector dest = src.matProdRowVect(current_pose);
return dest; return dest;
} }
FVector CViewport::getRelativePosCentering(int index, const FVector &src) { FVector CViewport::getRelativePosCentering(int index, const FVector &src) {
FVector dest; FVector dest;
FPose pose = getPose(); FPose pose = getPose();
FVector tv = src.MatProdRowVect(pose); FVector tv = src.matProdRowVect(pose);
double val; double val;
if (index <2) { if (index <2) {
@ -264,7 +264,7 @@ FVector CViewport::getRelativePosCentering(int index, const FVector &src) {
FVector CViewport::getRelativePosCentering2(int index, const FVector &src) { FVector CViewport::getRelativePosCentering2(int index, const FVector &src) {
FVector dest; FVector dest;
FPose pose = getRawPose(); FPose pose = getRawPose();
FVector tv = src.MatProdRowVect(pose); FVector tv = src.matProdRowVect(pose);
double val; double val;
if (index <2) { if (index <2) {