Browse Source

Fix offset by 1 in number of rows / cols

Phyks (Lucas Verney) 4 years ago
parent
commit
f5b1189d19
5 changed files with 24 additions and 17 deletions
  1. BIN
      res/assets/heightmap.arg
  2. 15
    14
      res/config.json
  3. 5
    0
      scripts/CMakeLists.txt
  4. 4
    2
      scripts/libskimap/output.py
  5. 0
    1
      src/core/Terrain.cc

BIN
res/assets/heightmap.arg View File


+ 15
- 14
res/config.json View File

@@ -8,9 +8,9 @@
8 8
     "NEAR": 0.1,
9 9
     "FAR": 800000.0,
10 10
 
11
-    "DEFAULT_EYE": [8000.0, 0.0, 3000.0],
11
+    "DEFAULT_EYE": [0.0, 0.0, 3000.0],
12 12
     "DEFAULT_CENTER": [0.0, 0.0, 0.0],
13
-    "DEFAULT_UP": [0.0, 0.0, 1.0],
13
+    "DEFAULT_UP": [1.0, 0.0, 0.0],
14 14
 
15 15
     "TERRAIN_MATERIAL": [
16 16
         [0.5, 0.5, 0.5, 1.0],
@@ -27,16 +27,17 @@
27 27
         [0.0, 0.0, 1.0, 1.0]
28 28
     ],
29 29
 
30
-    "HEIGHTMAP_METADATA": {
31
-        "CELLHEIGHT": 75.0,
32
-        "CELLWIDTH": 75.0,
33
-        "MAX_ALTITUDE": 3031.53,
34
-        "MEAN_ALTITUDE": 1916.115,
35
-        "N_COLS": 95,
36
-        "N_ROWS": 897,
37
-        "X_MAX": 996487.5,
38
-        "X_MIN": 989362.5,
39
-        "Y_MAX": 6396262.5,
40
-        "Y_MIN": 6328987.5
41
-    }
30
+    "HEIGHTMAP_METADATA":
31
+{
32
+    "CELLHEIGHT": 75.0,
33
+    "CELLWIDTH": 75.0,
34
+    "MAX_ALTITUDE": 2735.06,
35
+    "MEAN_ALTITUDE": 1897.3,
36
+    "N_COLS": 31,
37
+    "N_ROWS": 446,
38
+    "X_MAX": 989362.5,
39
+    "X_MIN": 987112.5,
40
+    "Y_MAX": 6362362.5,
41
+    "Y_MIN": 6328987.5
42
+}
42 43
 }

+ 5
- 0
scripts/CMakeLists.txt View File

@@ -2,3 +2,8 @@ add_custom_target (vars
2 2
     COMMAND [ -d "data" ] || mkdir data
3 3
     COMMAND ../scripts/skimap.py --lat-min 44.00092 --lng-min 6.60909 --lat-max 44.60190 --lng-max 6.73767 --out data/vars /home/phyks/OpenData/BD\ Alti\ 75m/BDALTIV2-75M_ASC_LAMB93_FXX_2013-10-01/1_DONNEES_LIVRAISON_2013-10-00130/BDALTIV2_MNT_75M_LAMB93_IGN69_FRANCEMETRO20130920
4 4
     WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
5
+
6
+add_custom_target (test
7
+    COMMAND [ -d "data" ] || mkdir data
8
+    COMMAND ../scripts/skimap.py --lat-min 44.00090 --lng-min 6.60909 --lat-max 44.30090 --lng-max 6.60009 --out data/test /home/phyks/OpenData/BD\ Alti\ 75m/BDALTIV2-75M_ASC_LAMB93_FXX_2013-10-01/1_DONNEES_LIVRAISON_2013-10-00130/BDALTIV2_MNT_75M_LAMB93_IGN69_FRANCEMETRO20130920
9
+    WORKING_DIRECTORY ${PROJECT_BINARY_DIR})

+ 4
- 2
scripts/libskimap/output.py View File

@@ -3,6 +3,8 @@
3 3
     (ARG) file (slightly modified implementation to fit with our needs).
4 4
     http://geotrellis.io/documentation/0.9.0/geotrellis/io/arg/
5 5
 """
6
+import math
7
+
6 8
 from . import tools
7 9
 
8 10
 
@@ -40,8 +42,8 @@ def format_arg(points):
40 42
         "y_max": y_max,
41 43
         "cellwidth": cellwidth,
42 44
         "cellheight": cellheight,
43
-        "cols": int((x_max - x_min) // cellwidth),
44
-        "rows": int((y_max - y_min) // cellheight),
45
+        "cols": math.ceil((x_max - x_min) / cellwidth) + 1,
46
+        "rows": math.ceil((y_max - y_min) / cellheight) + 1,
45 47
         # Extra (custom) metadata
46 48
         "mean_altitude": 0,  # Updated below
47 49
         "max_altitude": 0  # Update below

+ 0
- 1
src/core/Terrain.cc View File

@@ -8,7 +8,6 @@
8 8
 #include "Config.h"
9 9
 #include "Buffer.h"
10 10
 
11
-
12 11
 TerrainProgram::TerrainProgram(
13 12
         const std::string vertex_shader_filename,
14 13
         const std::string fragment_shader_filename)