jmlien / acd2d

Approximate Convex Decomposition of Polygons
MIT License
40 stars 20 forks source link

Segmentation fault #3

Open lukeqsun opened 6 years ago

lukeqsun commented 6 years ago

Got two kinds of "segmentation fault" when running the code. Here are the procedures for reproducing the errors: My environment: Ubuntu 16.04 x86-64 Repo head: b32d695 (current master) Compile:

$ git clone https://github.com/jmlien/acd2d.git
$ cd acd2d
$ make

Run for segmentation fault 1:

$ ./acd2d_gui ./test_env/hole2.poly

Console output:

 - Input: ./test_env/hole2.poly
           concavity tolerance=0
      concavity weight (alpha)=0
        distance weight (beta)=1
 GUI Usage:
 d:                  decompose once
 D:                  decompose all
 n:                  show/hide normal direction 
 h:                  show/hide convex hulls
 r:                  reset camera
 space bar:          reload polygon
 s:                  save decomposition
 p:                  save rendering to PS file
 +/-:                zoom in/out
 arrow keys:         translate

Gdb output:

 0x00000000000001a1 in ?? ()
 (gdb) bt
 #0  0x00000000000001a1 in ?? ()
 #1  0x000000000040cdde in acd2d::cd_2d::decompose_OUT(double, acd2d::cd_polygon&, cd2d::cd_poly&)
     ()
 #2  0x000000000040f1df in acd2d::cd_2d::decompose(double, acd2d::IConcavityMeasure*) ()
 #3  0x000000000040f4c1 in acd2d::cd_2d::decomposeAll(double, acd2d::IConcavityMeasure*) ()
 #4  0x0000000000419874 in decomposeAll () at gui/acd2d_main_gui.cpp:186
 #5  0x0000000000419fa9 in Keyboard (key=68 'D', x=169, y=282) at gui/acd2d_main_gui.cpp:294
 #6  0x00007fb4f12d7d1f in glutMainLoopEvent () from /usr/lib/x86_64-linux-gnu/libglut.so.3
 #7  0x00007fb4f12d8145 in glutMainLoop () from /usr/lib/x86_64-linux-gnu/libglut.so.3
 #8  0x000000000041aa19 in gli::gliMainLoop () at gui/GL/gli.h:39
 #9  0x000000000041926a in main (argc=2, argv=0x7ffda5663ff8) at gui/acd2d_main_gui.cpp:106

Run for segmentation fault 2:

$ ./acd2d_gui ./test_env/my_test.poly

Console output:

- Input: ./test_env/ocsc.poly
          concavity tolerance=0
     concavity weight (alpha)=0
       distance weight (beta)=1
GUI Usage:
d:                  decompose once
D:                  decompose all
n:                  show/hide normal direction 
h:                  show/hide convex hulls
r:                  reset camera
space bar:          reload polygon
s:                  save decomposition
p:                  save rendering to PS file
+/-:                zoom in/out
arrow keys:         translate
! ERROR: FindCut_Out Error
! ERROR Info: U=-nan
! ERROR Info: U=-nan
! ERROR Info: U=-nan
! ERROR Info: U=-nan
! ERROR Info: U=-nan
! ERROR Info: U=-nan
! ERROR Info: U=-nan
! ERROR Info: Cut line O=(0.975589,-0.430997)
! ERROR Info: Cut line V=(-nan,-nan)
! ERROR Info: Polygon=
8 out
0.981055 -0.241068
0.975589 -0.430997
0.981055 -0.241068
0.674894 -0.147007
0.390904 -0.149679
0.388231 -0.111591
0.674894 -0.120278
0.674894 -0.147007
1 2 3 4 5 6 7 8 

Gdb output:

0x0000000000000080 in ?? ()
(gdb) bt
#0  0x0000000000000080 in ?? ()
#1  0x000000000044a5ce in acd2d::setBridge (e=0xa84970, s=<optimized out>, b=0x0)
#2  acd2d::removeBridge (v=0xa84af0)
#3  acd2d::cd_vertex::~cd_vertex (this=0xa84af0, __in_chrg=<optimized out>)
#4  acd2d::cd_poly::destroy (this=0xa84b80)
#5  acd2d::cd_polygon::destroy (this=this@entry=0xa85350)
#6  0x000000000044cfd9 in acd2d::cd_2d::destroy (this=this@entry=0x7ffff76ed628)

Please check the attachment "my_test.txt" for "my_test.poly".

Thank you! Luke

Attachments: my_test.txt

afrixs commented 4 years ago

Hi, I fixed the problem in my fork, if you want to try it out.