diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/poser.c | 5 | ||||
-rw-r--r-- | src/poser_charlesslow.c | 2 | ||||
-rw-r--r-- | src/poser_daveortho.c | 2 | ||||
-rw-r--r-- | src/poser_epnp.c | 4 | ||||
-rw-r--r-- | src/poser_sba.c | 23 | ||||
-rw-r--r-- | src/poser_turveytori.c | 2 | ||||
-rwxr-xr-x | src/survive_cal.c | 2 | ||||
-rw-r--r-- | src/survive_playback.c | 14 |
8 files changed, 30 insertions, 24 deletions
diff --git a/src/poser.c b/src/poser.c index ea5812e..9a0de24 100644 --- a/src/poser.c +++ b/src/poser.c @@ -4,6 +4,9 @@ #include <stdio.h> #include <survive.h> +#define _USE_MATH_DEFINES // for C +#include <math.h> + void PoserData_poser_raw_pose_func(PoserData *poser_data, SurviveObject *so, uint8_t lighthouse, SurvivePose *pose) { if (poser_data->rawposeproc) { poser_data->rawposeproc(so, lighthouse, pose, poser_data->userdata); @@ -51,7 +54,7 @@ void PoserData_lighthouse_pose_func(PoserData *poser_data, SurviveObject *so, ui ApplyPoseToPose(&lighthouse2obj, &arb2object, &lighthouse2arb); // Now find the space with the same origin, but rotated so that gravity is up - SurvivePose lighthouse2objUp = {}, object2objUp = {}; + SurvivePose lighthouse2objUp = {0}, object2objUp = {0}; if (quatmagnitude(so->activations.accel)) { quatfrom2vectors(object2objUp.Rot, so->activations.accel, up); } else { diff --git a/src/poser_charlesslow.c b/src/poser_charlesslow.c index c7d9033..bc6683a 100644 --- a/src/poser_charlesslow.c +++ b/src/poser_charlesslow.c @@ -53,7 +53,7 @@ int PoserCharlesSlow( SurviveObject * so, PoserData * pd ) printf( "%f %f %f\n", hmd_points[p*3+0], hmd_points[p*3+1], hmd_points[p*3+2] ); } - SurvivePose additionalTx = {}; + SurvivePose additionalTx = {0}; int lh, cycle; FLT dz, dy, dx; diff --git a/src/poser_daveortho.c b/src/poser_daveortho.c index c922b2e..c47bceb 100644 --- a/src/poser_daveortho.c +++ b/src/poser_daveortho.c @@ -127,7 +127,7 @@ int PoserDaveOrtho( SurviveObject * so, PoserData * pd ) PoserDataFullScene * fs = (PoserDataFullScene*)pd; int LH_ID; - SurvivePose alignLh0ToXAxis = {}; + SurvivePose alignLh0ToXAxis = {0}; for( LH_ID = 0; LH_ID < 2; LH_ID++ ) { int i; diff --git a/src/poser_epnp.c b/src/poser_epnp.c index ea1e735..c294c0c 100644 --- a/src/poser_epnp.c +++ b/src/poser_epnp.c @@ -13,7 +13,7 @@ #include "stdio.h" static SurvivePose solve_correspondence(SurviveObject *so, epnp *pnp, bool cameraToWorld) { - SurvivePose rtn = {}; + SurvivePose rtn = {0}; // std::cerr << "Solving for " << cal_imagePoints.size() << " correspondents" << std::endl; if (pnp->number_of_correspondences <= 3) { SurviveContext *ctx = so->ctx; @@ -140,7 +140,7 @@ int PoserEPNP(SurviveObject *so, PoserData *pd) { SurvivePose pose = solve_correspondence(so, &pnp, false); - SurvivePose txPose = {}; + SurvivePose txPose = {0}; quatrotatevector(txPose.Pos, so->ctx->bsd[lh].Pose.Rot, pose.Pos); for (int i = 0; i < 3; i++) { txPose.Pos[i] += so->ctx->bsd[lh].Pose.Pos[i]; diff --git a/src/poser_sba.c b/src/poser_sba.c index 82fbd56..069e1d0 100644 --- a/src/poser_sba.c +++ b/src/poser_sba.c @@ -47,7 +47,7 @@ void metric_function(int j, int i, double *aj, double *xij, void *adata) { SurviveObject *so = ctx->so; SurvivePose obj2world = ctx->obj_pose; - FLT sensorInWorld[3] = {}; + FLT sensorInWorld[3] = {0}; ApplyPoseToPoint(sensorInWorld, &obj2world, &so->sensor_locations[i * 3]); survive_reproject_from_pose_with_config(so->ctx, &ctx->calibration_config, j, (SurvivePose *)aj, sensorInWorld, xij); @@ -213,7 +213,7 @@ static double run_sba_find_3d_structure_single_sweep(survive_calibration_config pdl->hdr.pt = hdr.pt; pdl->hdr.rawposeproc = sba_set_position; - sba_set_position_t locations = {}; + sba_set_position_t locations = {0}; pdl->hdr.userdata = &locations; driver(so, &pdl->hdr); pdl->hdr = hdr; @@ -229,8 +229,8 @@ static double run_sba_find_3d_structure_single_sweep(survive_calibration_config } } - double opts[SBA_OPTSSZ] = {}; - double info[SBA_INFOSZ] = {}; + double opts[SBA_OPTSSZ] = {0}; + double info[SBA_INFOSZ] = {0}; sba_context_single_sweep ctx = {.hdr = {options, &pdl->hdr, so}, .acode = acode, .lh = lh}; @@ -309,7 +309,7 @@ static double run_sba_find_3d_structure(SBAData *d, survive_calibration_config o pdl->hdr.pt = hdr.pt; pdl->hdr.rawposeproc = sba_set_position; - sba_set_position_t locations = {}; + sba_set_position_t locations = {0}; pdl->hdr.userdata = &locations; driver(so, &pdl->hdr); pdl->hdr = hdr; @@ -326,8 +326,8 @@ static double run_sba_find_3d_structure(SBAData *d, survive_calibration_config o } } - double opts[SBA_OPTSSZ] = {}; - double info[SBA_INFOSZ] = {}; + double opts[SBA_OPTSSZ] = {0}; + double info[SBA_INFOSZ] = {0}; sba_context ctx = {options, &pdl->hdr, so}; @@ -402,7 +402,7 @@ static double run_sba(survive_calibration_config options, PoserDataFullScene *pd } else { SV_INFO("Not using a seed poser for SBA; results will likely be way off"); for (int i = 0; i < 2; i++) { - so->ctx->bsd[i].Pose = (SurvivePose){}; + so->ctx->bsd[i].Pose = (SurvivePose){0}; so->ctx->bsd[i].Pose.Rot[0] = 1.; } } @@ -410,8 +410,8 @@ static double run_sba(survive_calibration_config options, PoserDataFullScene *pd // PoserCharlesSlow(so, (PoserData *)pdfs); } - double opts[SBA_OPTSSZ] = {}; - double info[SBA_INFOSZ] = {}; + double opts[SBA_OPTSSZ] = {0}; + double info[SBA_INFOSZ] = {0}; opts[0] = SBA_INIT_MU; opts[1] = SBA_STOP_THRESH; @@ -438,14 +438,13 @@ static double run_sba(survive_calibration_config options, PoserDataFullScene *pd info); // info if (status >= 0) { - SurvivePose additionalTx = {}; + SurvivePose additionalTx = {0}; for (int i = 0; i < NUM_LIGHTHOUSES; i++) { if (quatmagnitude(sbactx.camera_params[i].Rot) != 0) { PoserData_lighthouse_pose_func(&pdfs->hdr, so, i, &additionalTx, &sbactx.camera_params[i], &sbactx.obj_pose); } } - } else { SurviveContext *ctx = so->ctx; SV_INFO("SBA was unable to run %d", status); diff --git a/src/poser_turveytori.c b/src/poser_turveytori.c index 2d3f802..035fca7 100644 --- a/src/poser_turveytori.c +++ b/src/poser_turveytori.c @@ -1443,7 +1443,7 @@ static Point SolveForLighthouse(FLT posOut[3], FLT quatOut[4], TrackedObject *ob lighthousePose.Pos[1] = refinedEstimateGd.y; lighthousePose.Pos[2] = refinedEstimateGd.z; - SurvivePose assumedObj = {}; + SurvivePose assumedObj = {0}; FLT negZ[3] = {0, 0, 1}; quatfrom2vectors(assumedObj.Rot, toriData->down, negZ); diff --git a/src/survive_cal.c b/src/survive_cal.c index 218f5c1..25e43b9 100755 --- a/src/survive_cal.c +++ b/src/survive_cal.c @@ -599,7 +599,7 @@ static void handle_calibration( struct SurviveCalData *cd ) for( obj = 0; obj < cd->numPoseObjects; obj++ ) { int i, j; - PoserDataFullScene fsd = {}; + PoserDataFullScene fsd = {0}; fsd.hdr.pt = POSERDATA_FULL_SCENE; for( j = 0; j < NUM_LIGHTHOUSES; j++ ) for( i = 0; i < SENSORS_PER_OBJECT; i++ ) diff --git a/src/survive_playback.c b/src/survive_playback.c index dc9a330..43a3c0b 100644 --- a/src/survive_playback.c +++ b/src/survive_playback.c @@ -6,7 +6,6 @@ #include <survive.h> #include <string.h> -#include <sys/time.h> #include "survive_config.h" #include "survive_default_devices.h" @@ -14,6 +13,14 @@ #include "os_generic.h" #include "stdarg.h" +#ifdef _WIN32 +typedef long ssize_t; +#define SSIZE_MAX LONG_MAX + +ssize_t getdelim(char ** lineptr, size_t * n, int delimiter, FILE *stream); +ssize_t getline(char **lineptr, size_t * n, FILE *stream); +#endif + typedef struct SurviveRecordingData { bool alwaysWriteStdOut; bool writeRawLight; @@ -267,12 +274,10 @@ static int playback_poll(struct SurviveContext *ctx, void *_driver) { FILE *f = driver->playback_file; if (f && !feof(f) && !ferror(f)) { - int i; driver->lineno++; char *line; if (driver->next_time_us == 0) { - char *buffer; size_t n = 0; ssize_t r = getdelim(&line, &n, ' ', f); if (r <= 0) @@ -290,7 +295,6 @@ static int playback_poll(struct SurviveContext *ctx, void *_driver) { return 0; driver->next_time_us = 0; - char *buffer; size_t n = 0; ssize_t r = getline(&line, &n, f); if (r <= 0) @@ -397,7 +401,7 @@ int DriverRegPlayback(SurviveContext *ctx) { while (!feof(sp->playback_file) && !ferror(sp->playback_file)) { char *line = 0; size_t n; - ssize_t r = getline(&line, &n, sp->playback_file); + int r = getline(&line, &n, sp->playback_file); if (r <= 0) continue; |