diff --git a/src/test_utilities.cpp b/src/test_utilities.cpp index bfb898e..556c6ee 100644 --- a/src/test_utilities.cpp +++ b/src/test_utilities.cpp @@ -51,7 +51,7 @@ OrbitTracker* create_orbit_tracker_with_min_time(int body_index, double min_time tracker->initial_angle = 0.0; tracker->previous_angle = 0.0; tracker->accumulated_rotation = 0.0; - tracker->wrap_count = 0; + tracker->initialized = false; tracker->orbit_completed = false; tracker->time_at_completion = 0.0; tracker->min_time_seconds = min_time_seconds; @@ -82,7 +82,7 @@ static void reset_tracker_fields(OrbitTracker* tracker) { tracker->initial_angle = 0.0; tracker->previous_angle = 0.0; tracker->accumulated_rotation = 0.0; - tracker->wrap_count = 0; + tracker->initialized = false; tracker->orbit_completed = false; tracker->time_at_completion = 0.0; } @@ -111,11 +111,11 @@ void update_orbit_tracker(OrbitTracker* tracker, CelestialBody* body, CelestialB current_angle = atan2(relative_pos.y, relative_pos.x); } - if (tracker->wrap_count == 0) { + if (!tracker->initialized) { tracker->initial_angle = current_angle; tracker->previous_angle = current_angle; tracker->accumulated_rotation = 0.0; - tracker->wrap_count = 1; + tracker->initialized = true; return; } @@ -123,11 +123,9 @@ void update_orbit_tracker(OrbitTracker* tracker, CelestialBody* body, CelestialB if (angle_diff > M_PI) { angle_diff -= 2.0 * M_PI; - tracker->wrap_count++; } if (angle_diff < -M_PI) { angle_diff += 2.0 * M_PI; - tracker->wrap_count++; } tracker->accumulated_rotation += angle_diff; diff --git a/src/test_utilities.h b/src/test_utilities.h index 27c3a83..4267ae9 100644 --- a/src/test_utilities.h +++ b/src/test_utilities.h @@ -16,7 +16,7 @@ struct OrbitTracker { double initial_angle; double previous_angle; double accumulated_rotation; - int wrap_count; + bool initialized; bool orbit_completed; double time_at_completion; int body_index;