Browse Source

OrthograficView::radius_physical_pixels -> diameter_*

Johannes Hofmann 7 years ago
parent
commit
87739486fd
2 changed files with 6 additions and 6 deletions
  1. 2
    2
      src/atmos_layer.rs
  2. 4
    4
      src/orthografic_view.rs

+ 2
- 2
src/atmos_layer.rs View File

72
         map_view: &MapView,
72
         map_view: &MapView,
73
     ) {
73
     ) {
74
         let (scale_x, scale_y) = {
74
         let (scale_x, scale_y) = {
75
-            let radius = OrthograficView::radius_physical_pixels(map_view);
76
-            ((radius / map_view.width) as f32, (radius / map_view.height) as f32)
75
+            let diam = OrthograficView::diameter_physical_pixels(map_view);
76
+            ((diam / map_view.width) as f32, (diam / map_view.height) as f32)
77
         };
77
         };
78
 
78
 
79
         self.program.set_uniform_2f(cx, self.scale_uniform, scale_x, scale_y);
79
         self.program.set_uniform_2f(cx, self.scale_uniform, scale_x, scale_y);

+ 4
- 4
src/orthografic_view.rs View File

211
         tiles
211
         tiles
212
     }
212
     }
213
 
213
 
214
-    pub fn radius_physical_pixels(map_view: &MapView) -> f64 {
214
+    pub fn diameter_physical_pixels(map_view: &MapView) -> f64 {
215
         2.0f64.powf(map_view.zoom) * (FRAC_1_PI * f64::from(map_view.tile_size))
215
         2.0f64.powf(map_view.zoom) * (FRAC_1_PI * f64::from(map_view.tile_size))
216
     }
216
     }
217
 
217
 
218
     pub fn transformation_matrix(map_view: &MapView) -> Matrix3<f64> {
218
     pub fn transformation_matrix(map_view: &MapView) -> Matrix3<f64> {
219
         let (scale_x, scale_y) = {
219
         let (scale_x, scale_y) = {
220
-            let radius = Self::radius_physical_pixels(map_view);
221
-            (radius / map_view.width, radius / map_view.height)
220
+            let diam = Self::diameter_physical_pixels(map_view);
221
+            (diam / map_view.width, diam / map_view.height)
222
         };
222
         };
223
 
223
 
224
         let scale_mat: Matrix3<f64> = Matrix3::from_cols(
224
         let scale_mat: Matrix3<f64> = Matrix3::from_cols(
290
     pub fn screen_coord_to_latlonrad(map_view: &MapView, screen_coord: ScreenCoord) -> LatLonRad {
290
     pub fn screen_coord_to_latlonrad(map_view: &MapView, screen_coord: ScreenCoord) -> LatLonRad {
291
         // Point on unit sphere
291
         // Point on unit sphere
292
         let sphere_point = {
292
         let sphere_point = {
293
-            let recip_radius = 2.0 * Self::radius_physical_pixels(map_view).recip();
293
+            let recip_radius = 2.0 * Self::diameter_physical_pixels(map_view).recip();
294
             let sx = (screen_coord.x - map_view.width * 0.5) * recip_radius;
294
             let sx = (screen_coord.x - map_view.width * 0.5) * recip_radius;
295
             let sy = (screen_coord.y - map_view.height * 0.5) * -recip_radius;
295
             let sy = (screen_coord.y - map_view.height * 0.5) * -recip_radius;
296
             let t = 1.0 - sx * sx - sy * sy;
296
             let t = 1.0 - sx * sx - sy * sy;