cgal icon indicating copy to clipboard operation
cgal copied to clipboard

CGAL error: assertion violation! When using "CGAL::Polygon_mesh_processing::extrude_mesh()"

Open Dwight98 opened this issue 2 years ago • 8 comments

Issue Details

I loaded my own mesh file (.obj) which is creadted by another library called "open3D". The reconstruction method is “Ball pivoting”. I want to use the"Extrude_mesh()" to get an extrusion model, and the direction of extrusion is only negative to the z-axis. The code compiles fine, but when I run it after a few minutes I get an error like this:

CGAL error: assertion violation! Expression : idx < data.size() File : D:\Programs\dev\CGAL-5.5.1\include\CGAL\Surface_mesh\Properties.h Line : 193 Explanation: Refer to the bug-reporting instructions at https://www.cgal.org/bug_report.html

Source Code

head file:

#include<ctime>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polygon_mesh_processing/compute_normal.h>
#include <CGAL/Polygon_mesh_processing/extrude.h>
#include <CGAL/boost/graph/IO/polygon_mesh_io.h>
#include <CGAL/Polygon_mesh_processing.h>
#include <CGAL/IO/OBJ.h>       
#include <CGAL/Polygon_mesh_processing/IO/polygon_mesh_io.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include<CGAL/Polygon_mesh_processing/border.h>

typedef:
typedef CGAL::Exact_predicates_exact_constructions_kernel  Kernel;
typedef Kernel::Point_3 Point;
typedef CGAL::Surface_mesh<Point> SM;
typedef Kernel::Vector_3 Vector;

code:
        auto start = std::clock();
	double extrudeVector[3] = { 0, 0, -500 };
	SM mesh;
	SM outMesh;
	CGAL::IO::read_polygon_mesh(v2, mesh);
	CGAL::Polygon_mesh_processing::extrude_mesh(mesh, outMesh, *new Vector(extrudeVector[0], extrudeVector[1], extrudeVector[2]));
	mesh.clear();
	CGAL::IO::write_polygon_mesh(v82, outMesh, CGAL::parameters::stream_precision(17));
	endTime = clock();
	std::cout << "时间是(ms):" << endTime - startTime;
	return EXIT_FAILURE;

Environment

  • Operating system (Windows/Mac/Linux, 32/64 bits): Windows 64 bits
  • Compiler: Visual Studio 2019
  • Release or debug mode: debug
  • Specific flags used (if any):
  • CGAL version: 5.5.1
  • Boost version: 1.71.0
  • Other libraries versions if used (Eigen, TBB, etc.): Eigen 3

Dwight98 avatar Sep 06 '23 06:09 Dwight98

Without the model it is hard to tell what is going wrong. Could you share it? My guess is that the model is closed and we did not check that in the function.

sloriot avatar Sep 06 '23 06:09 sloriot

Without the model it is hard to tell what is going wrong. Could you share it? My guess is that the model is closed and we did not check that in the function.

how to share it to you

Dwight98 avatar Sep 06 '23 06:09 Dwight98

you can attach it in the issue or put it on gist.github.com

sloriot avatar Sep 06 '23 06:09 sloriot

OK I will share it to you. Apart from that, I also want tell you another issue which I also submitt on github , and its title is the same as this issue. I will share both two mesh modeles with you, please help me analyze this problem as well. Thank you very much!

tips: Could you please provide your email address? My file is too large to upload directly as an attachment

Dwight98 avatar Sep 06 '23 07:09 Dwight98

OK I will share it to you. Apart from that, I also want tell you another issue which I also submitt on github , and its title is the same as this issue. I will share both two mesh modeles with you, please help me analyze this problem as well. Thank you very much!

tips: Could you please provide your email address? My file is too large to upload directly as an attachment

Another issue https://github.com/CGAL/cgal/issues/7690

Dwight98 avatar Sep 06 '23 07:09 Dwight98

Maybe try to decimate the model and see if there is still an issue. Otherwise using an only file sharing online (dropbox, wetransfer, google drive, ...).

sloriot avatar Sep 06 '23 07:09 sloriot

Maybe try to decimate the model and see if there is still an issue. Otherwise using an only file sharing online (dropbox, wetransfer, google drive, ...). I could use the wetransfer, but that also needs your email.

Dwight98 avatar Sep 06 '23 07:09 Dwight98

Maybe try to decimate the model and see if there is still an issue. Otherwise using an only file sharing online (dropbox, wetransfer, google drive, ...).

Oh,sorry, I forget that I can generate a link to you. Below is the wetransfer link for the shared file: https://we.tl/t-KR136DuBtB

Dwight98 avatar Sep 06 '23 07:09 Dwight98