Wrap horizontal aircraft position to map extents

This commit is contained in:
Marek S. Łukasiewicz 2025-12-17 15:36:43 +01:00
parent 59c9c54e35
commit aaef0b0475

View file

@ -282,6 +282,10 @@ Vector2 MarshConnector::local_meters_from_global_degrees(double latitude,
// Y East is just length along the circle of latitude
double y = (lon - lon0) * (EARTH_RADIUS * cos(lat0));
const double map_size = 3000.0;
x = (Math::fract(x / map_size + 0.5) - 0.5) * map_size;
y = (Math::fract(y / map_size + 0.5) - 0.5) * map_size;
return Vector2(x, y);
}
void MarshConnector::handle_sim_state(mavlink_message_t message) {