summaryrefslogtreecommitdiff
path: root/src/mbgl/map/transform_state.hpp
diff options
context:
space:
mode:
authorAnsis Brammanis <brammanis@gmail.com>2016-12-14 15:17:01 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-12-21 15:46:36 -0800
commit38b5cb0c7766152f7e49cce8bd6c5d3e04dd0663 (patch)
tree9f64568fbe56a17a0c1fcd5396bf6c9e80992843 /src/mbgl/map/transform_state.hpp
parentebd241363d5c926d471559208f391190666febb9 (diff)
downloadqtlocation-mapboxgl-38b5cb0c7766152f7e49cce8bd6c5d3e04dd0663.tar.gz
[core, ios] replace `altitude` with `fov`
ported from -js: eb6c6596c6a7a61363d30356674e0002153b1d19 `altitude` was a terribly-named variable that was used to indirectly control the fov. This should eliminate some confusion. `altitude` was equivalent to `cameraToCenterDistance / height`
Diffstat (limited to 'src/mbgl/map/transform_state.hpp')
-rw-r--r--src/mbgl/map/transform_state.hpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mbgl/map/transform_state.hpp b/src/mbgl/map/transform_state.hpp
index 6faaf4ac41..a35aa5a255 100644
--- a/src/mbgl/map/transform_state.hpp
+++ b/src/mbgl/map/transform_state.hpp
@@ -56,7 +56,8 @@ public:
// Rotation
float getAngle() const;
- float getAltitude() const;
+ float getFieldOfView() const;
+ float getCameraToCenterDistance() const;
float getPitch() const;
// State
@@ -109,7 +110,11 @@ private:
double x = 0, y = 0;
double angle = 0;
double scale = 1;
- double altitude = 1.5;
+ // This fov value is somewhat arbitrary. The altitude of the camera used
+ // to be defined as 1.5 screen heights above the ground, which was an
+ // arbitrary choice. This is the fov equivalent to that value calculated with:
+ // `fov = 2 * arctan((height / 2) / (height * 1.5))`
+ double fov = 0.6435011087932844;
double pitch = 0.0;
// cache values for spherical mercator math