Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Corrected roundtripping altitude with rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
1ec5 committed Sep 4, 2015
1 parent 02cc15f commit c11a45d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions platform/ios/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1825,7 +1825,7 @@ - (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration a
double angle = -1;
if (camera.heading >= 0)
{
angle = MGLRadiansFromDegrees(mbgl::util::wrap(-camera.heading, 0., 360.));
angle = MGLRadiansFromDegrees(-camera.heading);
}
double pitch = -1;
if (camera.pitch >= 0)
Expand All @@ -1851,12 +1851,12 @@ - (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration a
else // portrait
{
sw = _mbglMap->latLngForProjectedMeters({
centerMeters.northing - centerToEdge * std::cos(angle) + centerToEdge * std::cos(angle) * std::sin(pitch) / 2,
centerMeters.easting - centerToEdge * std::sin(angle) + centerToEdge * std::sin(angle) * std::sin(pitch) / 2,
centerMeters.northing - centerToEdge * std::cos(-angle) + centerToEdge * std::cos(-angle) * std::sin(pitch) / 2,
centerMeters.easting - centerToEdge * std::sin(-angle) + centerToEdge * std::sin(-angle) * std::sin(pitch) / 2,
});
ne = _mbglMap->latLngForProjectedMeters({
centerMeters.northing + centerToEdge * std::cos(angle) - centerToEdge * std::cos(angle) * std::sin(pitch) / 2,
centerMeters.easting + centerToEdge * std::sin(angle) - centerToEdge * std::sin(angle) * std::sin(pitch) / 2,
centerMeters.northing + centerToEdge * std::cos(-angle) - centerToEdge * std::cos(-angle) * std::sin(pitch) / 2,
centerMeters.easting + centerToEdge * std::sin(-angle) - centerToEdge * std::sin(-angle) * std::sin(pitch) / 2,
});
}

Expand All @@ -1865,7 +1865,7 @@ - (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration a
mbgl::CameraOptions options = _mbglMap->cameraForLatLngs({ sw, ne }, {});
options.center = centerLatLng;

if (angle >= 0)
if (camera.heading >= 0)
{
options.angle = angle;
}
Expand Down

0 comments on commit c11a45d

Please sign in to comment.