loicgasser / quantized-mesh-tile

Quantized-Mesh encoder/decoder and topology builder
MIT License
88 stars 20 forks source link

Behavior of method utils.collapseIntoTriangles #33

Open thiloSchlemmer opened 5 years ago

thiloSchlemmer commented 5 years ago

Hi Loic,

merry Christmas and a happy new year ... and so on :)

I was preparing a PR for a solution of the vertex normals on the tile edges and stumbled over the (for me irritating) behavior of the method utils.collapseIntoTriangles.

Long story short, i try to give the TerrainTopology a 'effectiveBoundary' and a list of overlapping triangles ( i guess you mentioned something like this in a earlier discussion). The TerrainTopology splits the triangles on the boundary and creates so a outer and a inner (effective) List of Faces.

For this design i used the collapseIntoTriangles-Method, but came up with irritating artefacts. Then i tried to replace 'collapseIntoTriangles'-Method with the shapely.ops.triangulate-Method. The result with 'shapely.ops.triangulate'-method (delauney-triangulation from geos-lib) gives a expected result of outer and inner faces. And...of course.. the unittests in TestCollapseIntoTriangle all failed, if i substitute the result of 'shapely.ops.triangulate' into 'collapseIntoTriangles'.

So , for now i dont get into the algorithmus of collapseIntoTriangles. Can you give me any hints to understand the concept?

Oh, i forgot...what i want to achieve...calculateNormals with all faces and use only the effective faces for the terrain tile.

loicgasser commented 5 years ago

Hi! Merry christmas! :santa: Yes collapse into triangles is a home made solution that works only for certain cases, when you cut an existing triangle with a straight line or a corner. It is a stupid optimization and using delaunay is probably better. So I have no quarry against you replacing it with delaunay and removing the tests for it entirely.