swordlegend / recastnavigation

Automatically exported from code.google.com/p/recastnavigation
zlib License
0 stars 0 forks source link

removeVertex failure bug #101

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1.Generate data in a tiled approach
2.Create a configuration where multiple polys share only a single edge vertex. 
These polys should each have three vertices or the first vert evaluated when 
building connected edges (starting RecastMesh.cpp ln 641) belongs to a triangle 
that had only three vertices including the removed vertex.  This logic will 
only find two connected vertices
3. Allow triangulate to run.

What is the expected output? What do you see instead?

Notice that only two vertices are found as candidates for triangulation. 
Triangulation returns the number of triangles as 1 but the tris list only has 
two valid indices.  An exception occurs when trying to use the third index in 
the tris array.

Expected result:  The removal of the polygon would be after the edge building 
and would not occur if a polygon could not be built.  This would have the 
negative effect of keeping a vertex along an edge and thus the edges would not 
stitch together correctly if merging of tiles occurs.

What version of the product are you using? On what operating system?
rev 167  Win7 64bit

Please provide any additional information below.

It seems like the best approach is to try to triangulate before actually 
removing the vertex and polygons associated with the vertex.  I'm not sure how 
to go about solving the link building for during a merge. Perhaps during 
merging a vertex could be added to the neighboring edge poly.

Original issue reported on code.google.com by shawnlha...@gmail.com on 4 Aug 2010 at 4:10

GoogleCodeExporter commented 9 years ago
Could you comment out the loop which tries to remove the vertices and post a 
screenshot of the case which produces the problem?

Original comment by memono...@gmail.com on 4 Aug 2010 at 8:38

GoogleCodeExporter commented 9 years ago
I don't know that I'll be able to find it that easy, but I'll give it a try.  I 
plotted out the verts to figure out what the configuration was. 

Original comment by shawnlha...@gmail.com on 5 Aug 2010 at 3:47

GoogleCodeExporter commented 9 years ago
Actually, I just added a function to dump rcContourSet to a file (R188). If you 
could dump the contour set which gives you the trouble and send it to me, I 
should be able to fix the problem more quickly. Dumping works like this:

        FileIO io;
        if (io.openForWrite("test.cset"))
            duDumpContourSet(*m_cset, &io);

You can find stdio implementation of the duFileIO in Sample.h/cpp. The class is 
called FileIO.

Original comment by memono...@gmail.com on 5 Aug 2010 at 6:07

GoogleCodeExporter commented 9 years ago
I've attached the contour cache for the tile I'm generating that is having 
trouble.  Sorry for the slow reply I was gone for the weekend. Hope this helps. 

Original comment by shawnlha...@gmail.com on 9 Aug 2010 at 7:20

Attachments:

GoogleCodeExporter commented 9 years ago
At first I though that those are crazy coordinates, but then I noticed that you 
are probably using centimeters as units.

The problem seems to be that a vertex that is shared by two non-adjacent 
polygons is removed.

In your case this is caused by a single voxel at contour boundary which messes 
up the contour simplification. This is similar case as issue #43. So there is 
sort of two issues in there.

Do you know where that single (non-walkable?) cell comes from?

Using really contour high simplification factor together with zero radius looks 
a bit risky. The are quite a few spots where obstacles are being missed.

I'll see if there is nice way to arrange the code so that I can triangulate the 
region before removing the data as you suggested.

Original comment by memono...@gmail.com on 10 Aug 2010 at 7:19

Attachments:

GoogleCodeExporter commented 9 years ago
I added fix for the removeVertex() bug in R191. I chose to add additional test 
if the vertex can be removed. Let me know if it works.

Original comment by memono...@gmail.com on 10 Aug 2010 at 8:30

GoogleCodeExporter commented 9 years ago
I'll test out the new code.  BTW, awesome to put in caching tech for things of 
this nature. 

Original comment by shawnlha...@gmail.com on 10 Aug 2010 at 4:18

GoogleCodeExporter commented 9 years ago
I've tested the fix in rv 191 and it worked for my test case.

Original comment by shawnlha...@gmail.com on 23 Aug 2010 at 6:35

GoogleCodeExporter commented 9 years ago

Original comment by memono...@gmail.com on 17 Sep 2010 at 10:22