When using PolyanyaFile to write a mesh file, the format doesn't quite match the specs. This PR fixes one of them and adds a workaround for the other.
Firstly, when writing the vertices, there is meant to be a count of the polygons written before the list, this was missing.
mesh
2
4 2
0.0 0.0 *2* 0 -1
...
Secondly, as originally reported in the issue is the neighbours aren't written. This isn't a huge issue as we don't seem to use them but it did mean we couldn't load the mesh file we wrote. Without calculating the neighbours, the workaround I add here is to set the is_one_way flag correctly if the neighbours list is empty.
Finally as a small bonus, I added a format limit to the coordinates to avoid annoying trailing .0000001's in some numbers.
This is a partial fix for https://github.com/vleue/polyanya/issues/42
When using
PolyanyaFile
to write a mesh file, the format doesn't quite match the specs. This PR fixes one of them and adds a workaround for the other.Firstly, when writing the vertices, there is meant to be a count of the polygons written before the list, this was missing.
Secondly, as originally reported in the issue is the neighbours aren't written. This isn't a huge issue as we don't seem to use them but it did mean we couldn't load the mesh file we wrote. Without calculating the neighbours, the workaround I add here is to set the
is_one_way
flag correctly if the neighbours list is empty.Finally as a small bonus, I added a format limit to the coordinates to avoid annoying trailing
.0000001
's in some numbers.This leaves the output looking like (e.g.):
Compared to using poly2mesh which generates this:
Edit: The original mesh without this change: