This commit is contained in:
2025-11-09 10:31:34 +01:00
parent 6d6da8f5b6
commit 1721cb5111
2 changed files with 17 additions and 5 deletions

View File

@@ -14,6 +14,7 @@
// Approximate radius of the Earth, in kilometers
#define EARTH_RADIUS 6371*1000
#define SCALE_FACTOR 100.0f
void compute_decimal_coords(struct IGC_DataPoint* dp)
{
@@ -64,7 +65,8 @@ void compute_world_coords(struct IGC_DataPoint* first, struct IGC_DataPoint* dp)
double z = dp->gps_alt;
// Compute current datapoint world coords as offset from base point
Vector3 current = {x-base_x, y-base_y, z-base_z};
//Vector3 current = {(x-base_x)/SCALE_FACTOR, (y-base_y)/SCALE_FACTOR, (z-base_z)/SCALE_FACTOR};
Vector3 current = {(x-base_x)/SCALE_FACTOR, (z-base_z)/SCALE_FACTOR, (y-base_y)/SCALE_FACTOR};
dp->w_coords = current;
printf("DEBUG: dp->w_coords = {x=%lf, y=%lf, z=%lf}; dp->meters = {lon=%lf, lat=%lf, gps_alt=%d\n", dp->w_coords.x, dp->w_coords.y, dp->w_coords.z, dp->lon.meters, dp->lat.meters, dp->gps_alt);

View File

@@ -15,8 +15,8 @@
void start_graphics(struct dp_node* list)
{
SetTraceLogLevel(4);
const int screenWidth = 800;
const int screenHeight = 450;
const int screenWidth = 1920;
const int screenHeight = 1080;
InitWindow(screenWidth, screenHeight, "camera");
@@ -28,6 +28,7 @@ void start_graphics(struct dp_node* list)
camera.projection = CAMERA_PERSPECTIVE;
Vector3 cubePosition = {0.0f, 0.0f, 0.0f};
Vector3 previous = {0.0f, 0.0f, 0.0f};
DisableCursor();
SetTargetFPS(60);
@@ -42,8 +43,17 @@ void start_graphics(struct dp_node* list)
ClearBackground(RAYWHITE);
BeginMode3D(camera);
// Bypass HEAD
struct dp_node* current = list->next;
while (current != NULL)
{
cubePosition = current->data->w_coords;
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
DrawLine3D(previous, cubePosition, BLUE);
previous = cubePosition;
current = current->next;
}
DrawGrid(1000, 1.0f);