tudelft3d / val3dity

Validation of 3D primitives according to the international standard ISO19107
GNU General Public License v3.0
92 stars 23 forks source link

Segfaulting with simple input #9

Closed bmmeijers closed 10 years ago

bmmeijers commented 10 years ago

With simple input file, val3dity on Linux segfaults (although I am not sure what is wrong, the input file is dealt with properly by tetgen 1.5.0).

./val3dity  /tmp/boekie.poly 
Reading 1 file(s).
Reading outer shell:    /tmp/boekie.poly

Validating surface in 2D with GEOS (their projection)
-----all valid

Triangulating outer shell
-----done

Validating shell #0
-----Planarity
    yes
-----Combinatorial consistency
Error 306: some vertices are not referenced by faces
    [shell: #0; face: #-1]
    yes
-----Geometrical consistency
    yes
-----Orientation of normals
Segmentation fault

And the input file contents:

# Generated by 'solids.py' at 2014-01-30 13:01:17.741013
# Delft University of Technology, GIS technology
# Martijn Meijers <b.m.meijers@tudelft.nl>

# part 1 - node list
6 3 0 0
1 0 0 0
2 0 1 0
3 1 0 0
4 0 1 1
5 0 0 1
6 1 0 1

# Part 2 - facet list
# facet count, no boundary marker
5 0

# facet 1
1
3    1 2 3

# facet 2
1
3    4 5 6

# facet 3
1
4    1 5 4 2

# facet 4
1
4    1 3 6 5

# facet 5
1
4    3 2 4 6

# Part 3 - hole list
0            # no hole

# Part 4 - region list
0            # no region
bmmeijers commented 10 years ago

With zero based indexing and all comments removed, it segfaults even earlier:

6 3 0 0
0 0 0 0
1 0 1 0
2 1 0 0
3 0 1 1
4 0 0 1
5 1 0 1
5 0
1
3    0 1 2
1
3    3 4 5
1
4    0 4 3 1
1
4    0 2 5 4
1
4    2 1 3 5
0
0

Output:

$ ./val3dity /tmp/one.poly 
Reading 1 file(s).
Reading outer shell:    /tmp/one.poly

Validating surface in 2D with GEOS (their projection)
Segmentation fault
hugoledoux commented 10 years ago

Fixed. The # of holes is not mandatory, so you were right not to put it for your file. Now the code handles with or without, and should recover from spaces also between and after.