Wrap horizontal aircraft position to map extents
This commit is contained in:
parent
59c9c54e35
commit
aaef0b0475
1 changed files with 4 additions and 0 deletions
|
|
@ -282,6 +282,10 @@ Vector2 MarshConnector::local_meters_from_global_degrees(double latitude,
|
||||||
// Y East is just length along the circle of latitude
|
// Y East is just length along the circle of latitude
|
||||||
double y = (lon - lon0) * (EARTH_RADIUS * cos(lat0));
|
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);
|
return Vector2(x, y);
|
||||||
}
|
}
|
||||||
void MarshConnector::handle_sim_state(mavlink_message_t message) {
|
void MarshConnector::handle_sim_state(mavlink_message_t message) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue