cnr-isti-vclab / vcglib

The VCGlib is a C++, templated, no dependency, library for manipulation, processing and cleaning of triangle meshes
http://vcg.isti.cnr.it/vcglib
GNU General Public License v3.0
1.11k stars 355 forks source link

Quadric Edge Collapse Decimation crashes with !math::IsNAN(ndiff). #14

Open svenpilz opened 7 years ago

svenpilz commented 7 years ago

I have a textured mesh with 4958437 vn 9912299 fn (1.2GB OBJ file) that somehow crashes TriEdgeCollapseQuadricTex. Any idea how to debug this?

Starting Script of 1 actionsfilter: Simplification: Quadric Edge Collapse Decimation (with texture) meshlabserver: ../../../../vcglib/vcg/complex/algorithms/local_optimization/tri_edge_collapse_quadric_tex.h:358: vcg::tri::TriEdgeCollapseQuadricTex<TriMeshType, VertexPair, MYTYPE, HelperType>::ScalarType vcg::tri::TriEdgeCollapseQuadricTex<TriMeshType, VertexPair, MYTYPE, HelperType>::ComputeTexPriority(const double, vcg::Quadric5&, vcg::BaseParameterClass) [with TriMeshType = CMeshO; VertexPair = vcg::tri::BasicVertexPair; MYTYPE = vcg::tri::MyTriEdgeCollapseQTex; HelperType = vcg::tri::QuadricTexHelper; vcg::tri::TriEdgeCollapseQuadricTex<TriMeshType, VertexPair, MYTYPE, HelperType>::ScalarType = float]: Assertion `!math::IsNAN(ndiff)' failed.

cignoni commented 7 years ago

definitely hard to be debugged without an example. Can you try to produce a smaller file reproducing the issue? Try to select just a portion of the mesh, invert the selection, delete it, and try again. If you are able to reproduce it please send the file...

fanvanzh commented 2 years ago

maybe update face-normal by tri::UpdateNormal<Mesh0>::PerFaceNormalized(mesh)

before tex-simplification