aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Turvey <mturvey6@gmail.com>2017-05-30 17:04:00 -0700
committerMike Turvey <mturvey6@gmail.com>2017-05-30 17:04:00 -0700
commit5108f75390ee57fc4669a9110002585500176593 (patch)
tree3f4931c946d944af8aa818f8e97034610ec38296
parentc9b8dccdf41d89a7c696337357f115aa9f1066ca (diff)
downloadlibsurvive-5108f75390ee57fc4669a9110002585500176593.tar.gz
libsurvive-5108f75390ee57fc4669a9110002585500176593.tar.bz2
Mainly cleaning up warnings
-rw-r--r--calibrate.c48
-rw-r--r--src/poser_turveytori.c21
2 files changed, 44 insertions, 25 deletions
diff --git a/calibrate.c b/calibrate.c
index 43643b3..eaba8ac 100644
--- a/calibrate.c
+++ b/calibrate.c
@@ -134,8 +134,8 @@ char* sensor_name[32];
void DisplayPose(SurvivePose pose, size_t xResolution, size_t yResolution)
{
const FLT toScale = 2.0 / yResolution; // 2 meters across yResolution pixels
- const int windowCenterX = xResolution / 2;
- const int windowCenterY = yResolution / 2;
+ const int windowCenterX = (int)xResolution / 2;
+ const int windowCenterY = (int)yResolution / 2;
const FLT sizeScale = 100.0; // used to indicate change in size with change in Z
const int minRectSize = 10; // size at z=0
@@ -148,10 +148,10 @@ void DisplayPose(SurvivePose pose, size_t xResolution, size_t yResolution)
int x1, x2, y1, y2;
- x1 = windowCenterX - minRectSize - ((pose.Pos[2] * 40.0)) + (pose.Pos[0] * sizeScale);
- y1 = windowCenterY - minRectSize - ((pose.Pos[2] * 40.0)) + (pose.Pos[1] * sizeScale);
- x2 = windowCenterX + minRectSize + ((pose.Pos[2] * 40.0)) + (pose.Pos[0] * sizeScale);
- y2 = windowCenterY + minRectSize + ((pose.Pos[2] * 40.0)) + (pose.Pos[1] * sizeScale);
+ x1 = (int)(windowCenterX - minRectSize - ((pose.Pos[2] * 40.0)) + (pose.Pos[0] * sizeScale));
+ y1 = (int)(windowCenterY - minRectSize - ((pose.Pos[2] * 40.0)) + (pose.Pos[1] * sizeScale));
+ x2 = (int)(windowCenterX + minRectSize + ((pose.Pos[2] * 40.0)) + (pose.Pos[0] * sizeScale));
+ y2 = (int)(windowCenterY + minRectSize + ((pose.Pos[2] * 40.0)) + (pose.Pos[1] * sizeScale));
FLT xCenter = windowCenterX + (pose.Pos[0] * sizeScale);
FLT yCenter = windowCenterY + (pose.Pos[1] * sizeScale);
@@ -172,19 +172,19 @@ void DisplayPose(SurvivePose pose, size_t xResolution, size_t yResolution)
tmp1[1] = 0;
tmp1[2] = 0;
- quatrotatevector(&tmp1out, pose.Rot, tmp1);
+ quatrotatevector(tmp1out, pose.Rot, tmp1);
tmp2[0] = minRectSize + ((pose.Pos[2] * 40.0));
tmp2[1] = 0;
tmp2[2] = 0;
- quatrotatevector(&tmp2out, pose.Rot, tmp2);
+ quatrotatevector(tmp2out, pose.Rot, tmp2);
CNFGTackSegment(
- windowCenterX + (pose.Pos[0] * sizeScale) + tmp1out[0],
- windowCenterY + (pose.Pos[1] * sizeScale) + tmp1out[1],
- windowCenterX + (pose.Pos[0] * sizeScale) + tmp2out[0],
- windowCenterY + (pose.Pos[1] * sizeScale) + tmp2out[1]);
+ (short)(windowCenterX + (pose.Pos[0] * sizeScale) + tmp1out[0]),
+ (short)(windowCenterY + (pose.Pos[1] * sizeScale) + tmp1out[1]),
+ (short)(windowCenterX + (pose.Pos[0] * sizeScale) + tmp2out[0]),
+ (short)(windowCenterY + (pose.Pos[1] * sizeScale) + tmp2out[1]));
}
// line for the (0,-y) to (0,+y))
@@ -198,19 +198,19 @@ void DisplayPose(SurvivePose pose, size_t xResolution, size_t yResolution)
tmp1[1] = -minRectSize - ((pose.Pos[2] * 40.0));
tmp1[2] = 0;
- quatrotatevector(&tmp1out, pose.Rot, tmp1);
+ quatrotatevector(tmp1out, pose.Rot, tmp1);
tmp2[0] = 0;
tmp2[1] = minRectSize + ((pose.Pos[2] * 40.0));
tmp2[2] = 0;
- quatrotatevector(&tmp2out, pose.Rot, tmp2);
+ quatrotatevector(tmp2out, pose.Rot, tmp2);
CNFGTackSegment(
- windowCenterX + (pose.Pos[0] * sizeScale) + tmp1out[0],
- windowCenterY + (pose.Pos[1] * sizeScale) + tmp1out[1],
- windowCenterX + (pose.Pos[0] * sizeScale) + tmp2out[0],
- windowCenterY + (pose.Pos[1] * sizeScale) + tmp2out[1]);
+ (short)(windowCenterX + (pose.Pos[0] * sizeScale) + tmp1out[0]),
+ (short)(windowCenterY + (pose.Pos[1] * sizeScale) + tmp1out[1]),
+ (short)(windowCenterX + (pose.Pos[0] * sizeScale) + tmp2out[0]),
+ (short)(windowCenterY + (pose.Pos[1] * sizeScale) + tmp2out[1]));
}
// Small line to indicate (0,+y)
@@ -224,19 +224,19 @@ void DisplayPose(SurvivePose pose, size_t xResolution, size_t yResolution)
tmp1[2] = 0;
tmp1[0] = tmp1[1] * 0.3;
- quatrotatevector(&tmp1out, pose.Rot, tmp1);
+ quatrotatevector(tmp1out, pose.Rot, tmp1);
tmp2[1] = minRectSize + ((pose.Pos[2] * 40.0));
tmp2[2] = 0;
tmp2[0] = -(tmp1[1] * 0.3);
- quatrotatevector(&tmp2out, pose.Rot, tmp2);
+ quatrotatevector(tmp2out, pose.Rot, tmp2);
CNFGTackSegment(
- windowCenterX + (pose.Pos[0] * sizeScale) + tmp1out[0],
- windowCenterY + (pose.Pos[1] * sizeScale) + tmp1out[1],
- windowCenterX + (pose.Pos[0] * sizeScale) + tmp2out[0],
- windowCenterY + (pose.Pos[1] * sizeScale) + tmp2out[1]);
+ (short)(windowCenterX + (pose.Pos[0] * sizeScale) + tmp1out[0]),
+ (short)(windowCenterY + (pose.Pos[1] * sizeScale) + tmp1out[1]),
+ (short)(windowCenterX + (pose.Pos[0] * sizeScale) + tmp2out[0]),
+ (short)(windowCenterY + (pose.Pos[1] * sizeScale) + tmp2out[1]));
}
diff --git a/src/poser_turveytori.c b/src/poser_turveytori.c
index c7ef901..481a499 100644
--- a/src/poser_turveytori.c
+++ b/src/poser_turveytori.c
@@ -1467,7 +1467,26 @@ static void QuickPose(SurviveObject *so, int lh)
{
FLT pos[3], quat[4];
- SolveForLighthouse(pos, quat, to, so, 0, lh, 0);
+ // TODO: This countdown stuff is a total hack!
+ // it basically ignores all the logic to find the most reliable data points
+ // and just grabs a sample and uses it.
+
+ static int countdown = 5;
+
+ if (countdown > 0 && so->ctx->objs[0] == so)
+ {
+ SolveForLighthouse(pos, quat, to, so, 0, lh, 1);
+ countdown--;
+ }
+ else
+ {
+ SolveForLighthouse(pos, quat, to, so, 0, lh, 0);
+ }
+
+
+
+
+ //SolveForLighthouse(pos, quat, to, so, 0, lh, 0);
printf("!\n");
}