Failure condition of Uniform Mesh Resampling?
A processing system for 3D triangular meshes
Brought to you by:
cignoni,
granzuglia
"Uniform Mesh Resampling" fails with "Assertion `retIP' failed". I am stuck
trying to figure how this could happen.
The code says:
assert(retIP); // this should happen only if the starting mesh has degenerate
faces.
I do not think I have degenerate faces:
- select with area of zero: abs((x0(y1-y2) + x1(y2-y0) + x2*(y0-y1) )/2)<=0 selects no vertices or faces
- select with coincident vertices: (x0==x1 and y0==y1 and z0==z1) or (x0==x2 and y0==y2 and z0==z2) or (x1==x2 and y1==y2 and z1==z2) selects no vertices or faces
- "remove T-Vertices by ..." selects not vertices or faces
In the final case I am assuming that degerate triangles imply T-Vertices.
I have gone further to ensure that:
1] my mesh normals are reoriented coherently outwards
2] no self-intersecting faces as demonstrated by 'select self intersecting
faces"
3[ no non-manifold geometry: my mesh is a single connected two-manifold object
of genus 0. The only "hole" is the border around the edge of the plane
To this end I am stuck determining the cause of this assertion. I have only
encountered this at sufficiently high cell count (<0.2%) , presumably the
marching cubes algorith does not intersect the problematic geometry at lower
precision.
I've recorded this behavior in 1.2.2, 1.3.0a and latest svn (of meshlab,
libvcg and mpir)
The full error is:
meshlab: ../../../../vcglib/vcg/complex/trimesh/create/resampler.h:178:
vcg::tri::Resampler<old_mesh_type, new_mesh_type,="" flt,="" distfunctor="">::Walker::field_value vcg::tri::Resampler<old_mesh_type, new_mesh_type,="" flt,="" distfunctor="">::Walker::DistanceFromMesh(vcg::Point3f&,
vcg::tri::Resampler<old_mesh_type, new_mesh_type,="" flt,="" distfunctor="">::Walker::Old_Mesh*) : Assertion `retIP' failed.</old_mesh_type,></old_mesh_type,></old_mesh_type,>
I have taken a superficial look at the code flow, since I am unfamiliar with
the math involved:
field_value DistanceFromMesh(Point3f, Old_Mesh)
- get nearest face
bool InterpolationParameters(const TriangleType t, const Point3<scalartype> &
N, const Point3<scalartype> & P, Point3<scalartype> & L)
- pick projection axis of nearest face
bool InterpolationParameters(const TriangleType t, const int Axis, const
Point3<scalartype> & P, Point3<scalartype> & L)
- project nearest face
bool InterpolationParameters2(const Point2<scalartype> &V1,const
Point2<scalartype> &V2,const Point2<scalartype> &V3,const Point2<scalartype>
&P, Point3<scalartype> &L)
- compute barycentric coordinates etc </scalartype></scalartype></scalartype></scalartype></scalartype></scalartype></scalartype></scalartype></scalartype></scalartype>
particularly, this assertion is triggered:
if(fabs(Det) < 0.0000001) return false;
the determinant of a triangle is double it's area, so the process will fail if
any nearest face has an area less than 0.00000005
Not strictly degenerative per-se as equilateral triangles can have this area,
but closely enough "degenerate" considering the nearness of adjacent vertices.
I will now select, dilate, and decimate such faces.
=================================
However I am tempted to also modify the minimum determinant to something much
smaller, perhaps 0.0000000000001, since the smallest positive floating point
number allowed by c/c++ is 1.175494351e-38F
that might (though probably not) mean also modifying this assertion:
assert(L >= -0.00001);
What value should I pick?
It still crashes. I need help.
I have realized the web source code documentation I've been referencing is
out-of-date, so the previous post is invalid.
I am also starting to doubt the technique of projecting a point and a triangle
onto the plane of the greatest normal - is it not possible for the nearest
(non-degenerate) triangle of a point to not overlap in the direction of
projection?
In this example the point does not overlap the nearest triangle in the
direction of projection (ie it is not a convex combination of the projection)
x: left to right
y: up to down
z: front to back
.
|---------\
|----------\
|-----------\
|------------\