cjio icon indicating copy to clipboard operation
cjio copied to clipboard

incorrect triangle orientation after triangulation

Open longxiangxu321 opened this issue 7 months ago • 0 comments

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: libiary_raw

Surface normals of triangulated file: library_triangulated

Surface normals of the triangulated(sloppy) file: library_sloppy

Desktop (please complete the following information):

  • OS: Windows
  • Version 11

longxiangxu321 avatar Jun 25 '24 12:06 longxiangxu321