Volumes Of Fun
http://www.volumesoffun.com/phpBB3/

unusual result of smooth surfaceextractor
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=15&t=218
Page 1 of 1

Author:  ker [ Sun May 29, 2011 3:36 pm ]
Post subject:  unusual result of smooth surfaceextractor

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) ?

Author:  David Williams [ Mon May 30, 2011 12:37 pm ]
Post subject:  Re: unusual result of smooth surfaceextractor

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.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/