It is currently Tue Aug 11, 2020 10:12 pm


All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: unusual result of smooth surfaceextractor
PostPosted: Sun May 29, 2011 3:36 pm 
User avatar

Joined: Wed Jan 26, 2011 3:20 pm
Posts: 203
Location: Germany
The following rarely happens, but I noticed when it turned out to be a problem for newtondynamics.
It's hard to explain, so I'll dump the volume and it's result:

volume:
Code:
0   0   0   0   0   5
0   0   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0

0   0   0   0   0   9
0   0   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0

0   0   0   0   2   12
0   0   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0

0   0   0   0   6   15
0   0   0   0   0   1
0   0   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0

0   0   0   0   10  15
0   0   0   0   0   5
0   0   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0

0   0   0   3   13  15
0   0   0   0   0   9
0   0   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0


the extracted region is from 1 to 4 (meaning first row and column and last row and column are not in the region)

result:
Code:
# indices: 3
# vertices: 5
indices: 0,  1,  3,
vertices:
0:  4,  0,  3.88889,    0:  0.287406,   0.955624,   -0.0646662,
1:  3.75,   0,  4,  1:  0.115881,   0.993263,   0,
2:  4.11111,    0,  4,  2:  0.378032,   0.925793,   0,
3:  4,  0.111111,   4,  3:  0.296166,   0.955136,   0,
4:  4,  0,  4.11111,    4:  0.31543,    0.946291,   0.0709718,


Is this an expected result? more vertices than indices in some rare conditions where the result is only one (or maybe very few) triangle(s) ?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: unusual result of smooth surfaceextractor
PostPosted: Mon May 30, 2011 12:37 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Yes, I think it is possible that the surface extractor will generate a few unused vertices outside of the requested region. If you look at your output you can see that the two unused vertices are numbers 2 and 4, and both of these have a component set to 4.111... which is outside of the requested region.

A simple implementation of Marching Cubes would iterate over each cell and look at the 8 corner voxels. However, the implementation in PolyVox only actually samples one voxel for each cell it processes, and the value of the other voxels is deduced by performing bit-shifting operations on cells which have already been processed. This is potenrially faster as it's much less memory access, but it means that it has to actually go one cell past the end of the requested region. In doing this it generates some extra vertices which don't get connected up.

I never really worried about this as I assumed unused vertices were harmless. What problems do they cause for Newton? The percentage of unused vertices will be larger for smaller volumes - so in your example 40% of the vertices are unused but I think in real use the number is closer to 1-5%.

Anyway, the SurfaceMesh class does already have a 'removeUnusedVertices()' function which you can call. So try this to see if it solves your problem.


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net