cjio
cjio copied to clipboard
incorrect triangle orientation after triangulation
Describe the bug Some of the triangles has wrong normals.
cjio version cjio v0.9.0
To Reproduce
- Download the 3D BAG tile located at TU Delft https://3dbag.nl/en/download?tid=9-284-556
- The command line to triangulate
cjio 9-284-556.city.json lod_filter 2.2 triangulate save tudelft.city.json
with sloppy:
cjio 9-284-556.city.json lod_filter 2.2 triangulate --sloppy save tudelft_sloppy.city.json
Both operation give warning:
\cjio\geom_help.py:42: RuntimeWarning: overflow encountered in scalar multiply
n[0] += ( (poly[i][1] - poly[ne][1]) * (poly[i][2] + poly[ne][2]) )
\cjio\geom_help.py:44: RuntimeWarning: overflow encountered in scalar multiply
n[2] += ( (poly[i][0] - poly[ne][0]) * (poly[i][1] + poly[ne][1]) )
\cjio\geom_help.py:43: RuntimeWarning: overflow encountered in scalar multiply
n[1] += ( (poly[i][2] - poly[ne][2]) * (poly[i][0] + poly[ne][0]) )
Expected behavior The triangles should have consistent orientation/nomral of corresponding face.
Screenshots
Surface normals of raw cityjson file:
Surface normals of triangulated file:
Surface normals of the triangulated(sloppy) file:
Desktop (please complete the following information):
- OS: Windows
- Version 11