cityjson / cjio

CityJSON/io: Python CLI to process and manipulate CityJSON files
MIT License
126 stars 32 forks source link

glb converter normal computation error #159

Open balazsdukai opened 1 year ago

balazsdukai commented 1 year ago

Describe the bug

The normal calculation in the glb converter occasionally returns invalid vectors.

cjio version develop branch d503d035e7c1d9b1564090ef8417fc237bd5063b

To Reproduce run --release -- --metadata /home/balazs/Development/cjio_dbexport/tests/data/output/metadata.city.json --features /home/balazs/Development/cjio_dbexport/tests/data/output --output /data/work/bdukai/3dbasisvoorziening/3dtiles_buildings --format 3dtiles --python-bin /home/balazs/Development/cjio/venv/bin/python --export-grid --cellsize 100 --quadtree-criteria vertices --quadtree-limit 10000 --object-type building-part --object-type building --gltfpack-bin /opt/gltfpack

Expected behavior Handle the invalid geoms/normals more robustly.

Screenshots

[2023-01-20T12:52:26Z ERROR tyler] 3/20/8 conversion subprocess stdout: 
    Traceback (most recent call last):
      File "/home/balazs/Development/tyler/resources/python/convert_cityjsonfeatures.py", line 82, in <module>
        glb = cm.export2glb(do_triangulate=False)
      File "/home/balazs/Development/cjio/cjio/cityjson.py", line 1576, in export2glb
        glb = convert.to_glb(self, do_triangulate=do_triangulate)
      File "/home/balazs/Development/cjio/cjio/convert.py", line 303, in to_glb
        normals_np = np.concatenate(normals_per_geom)
      File "<__array_function__ internals>", line 200, in concatenate
    ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 2 dimension(s) and the array at index 1 has 1 dimension(s)

Additional context See the tyler tests on the 3d basisvoorziening.