3D Mesh model (.obj) Importing via vcglib causes Assertion 0 failed issue

615 views Asked by At

I'm trying to Import OBJ format 3D mesh file via VCG Library with this code below

vcg::tri::io::Importer<MyMesh>::Open(vcgMesh, path)

Almost every 3D mesh formats that /wrap/io_trimesh/import.h header supports are working fine. (STL, PLY, even OBJ!)
but only some specific OBJ file causes an error and crashes the application completely.
For example, OBJ file that I've got from this link https://free3d.com/3d-model/wwi-plane-pfalz-diii-a-90772.html

Here is the error msg that I've got

/vcg/simplex/edge/component.h:46: typename T::VertexType*& vcg::edge::EmptyCore<T>::V(int) [with T = MyUsedTypes; typename T::VertexType = MyVertex]: Assertion `0' failed [1]    24708 abort (core dumped)

The thing is I cannot even try and catch the error. and I couldn't find any solution to prevent my application to be crashed from it.
I've tried to open the file in blender and MeshLab. Those applications import the OBJ file without any problem.
Here are kind of related issues but none of the solutions work out on this case.
Failed to to simplify 3D models with vcglib, Assertion `0' failed
Assertion Failure when using vcglib examples

Is there any way to solve this problem? Even if it's a problem with vcglib itself and it's hard to fix it, it would be great if I could catch the error and prevent my application to be crashed. Please help! Thank you in advance.

1

There are 1 answers

6
Rockcat On

I've tried to open the file in blender and MeshLab. Those applications import the OBJ file without any problem.

Really? Your obj file is not valid, it is impossible that meshlab or blender will process a .obj file with lines as:

vt 0.349751 0.599421
vt 0.351053 0.607569
vt 0.369663 0.673393
vt nan nan
vt nan nan
vt nan nan

Also, some textures are with absolute paths like

map_Kd /C:/Documents and Settings/Jean-Marie/Mes documents/....