Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] remove_self_intersections changes the mesh and the reparation is less when it is build in Release than when i build my application in Debug

Subject: CGAL users discussion list

List archive

[cgal-discuss] remove_self_intersections changes the mesh and the reparation is less when it is build in Release than when i build my application in Debug


Chronological Thread 
  • From: sergio <>
  • To:
  • Subject: [cgal-discuss] remove_self_intersections changes the mesh and the reparation is less when it is build in Release than when i build my application in Debug
  • Date: Wed, 4 Jul 2018 02:33:57 -0700 (MST)
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=SoftFail ; spf=Pass
  • Ironport-phdr: 9a23:GfOHxh/WgnnZrf9uRHKM819IXTAuvvDOBiVQ1KB41+0cTK2v8tzYMVDF4r011RmVBduds6oMotGVmpioYXYH75eFvSJKW713fDhBt/8rmRc9CtWOE0zxIa2iRSU7GMNfSA0tpCnjYgBaF8nkelLdvGC54yIMFRXjLwp1Ifn+FpLPg8it2O2+55zebx9UiDahfLh/MAi4oQLNu8cMnIBsMLwxyhzHontJf+RZ22ZlLk+Nkhj/+8m94odt/zxftPw9+cFAV776f7kjQrxDEDsmKWE169b1uhTFUACC+2ETUmQSkhpPHgjF8BT3VYr/vyfmquZw3jSRMMvrRr42RDui9b9mRhHohikZNDA37W7YhdB/gq9AvBKspQBzz5LIbI2JKvZzeL7Wc9MARWpGW8ZcTzdBDZ2mb4sADuoBOvtToo7jp1QUsRS+BA+sBOzhyj9PnH/22rY30+skEQ7c3QwgG8gCv2jTrNXwLaofV/2+wqfPzTXGdfxW2DH95ZDOch87uv6DRrZwftTLxUYzEAPFi02cqYPiPzOS2eQNt3aU4/B8WuKojm4rsx1+oje1yccokIXJgZgVyl/C+C5kw4g1PcW1RFN6bNK6CpdcqSGXOoVsTs8/TWxltjw2x78YtZO9YSME0o4oxwTFZPyCa4WI4gzsVOKWITpggnJod6izhxCo/ke70eL8Ute73ExWoSpCl9nArnEN1xrN5cibUvZx40as1SiV2wzN6uxJL1o4mbfVJpMv2LI9lIQfvVzGHiDsmUX2iKGWdl8j+uit8+nnfK/pqYOdN49yhQH+PKMumta4AekjPQgOWnKU+eW41LH54UL5R7BKguUskqbFqJDaOdgbpqmhDgBJ3YYs8RK/Ay6739QZhnkIME9FeAmcj4XyIFHPIPX4De+ljFi2kTdrwerGPrz7DZnXIHjDiuSpQbEo4EFVzE8/zMtU+olPIrAHOvP6HEHr5/LCCRpsKAGuzOfgQIFj34gfX22BBbWeGKzXuF6MoOkoJr/fN8cupD/hJq19tLbVhngjlApFJPj77d4scHm9W89eDQCcaHvojM0GFD5T7AU7Re3uzlaFVGwIPirgb+cH/jg+TbmeI8LbXIn02e6O2S66GttdYWUUUgnRQ0etTJ2NXrI3UAzXIsJllWVZB779DYko3xuquUnxzL81d+c=

This is may application that i compile in windows in Release with the showed
CMakeList.txt and cgal_vtk_test.cpp files. When I try to repair this file:

Number intersection: 290
https://drive.google.com/file/d/1uqcbZqgtbiiXYjKnzzb5d-OXm4JAHqdx/view?usp=sharing

1. my application build in Release generate the following file:

Number intersections: 179
Add some visible holes and some deformations.
Repairing time:..................201.128 seconds.

https://drive.google.com/file/d/13Vfw0pP5Ymw0oo4RnfRjKTI_aTndb6P4/view?usp=sharing


2. my application compiled in Debug, it generate the following file:

Number intersections: 4
Repairing time:..................1072.96 seconds.

https://drive.google.com/file/d/1x1Z7qaNcnfGC8a24qzJI-DZEF3qqeLqq/view?usp=sharing


with warnings:

Expression : !"Returning no output. Filling hole with extra triangles is not
successful!"
File :
C:\dev\CGAL-4.12\include\CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h
Line : 1103
Explanation:
Refer to the bug-reporting instructions at
https://www.cgal.org/bug_report.html

The problem is that in debug build it takes around 17 min for reparacion and
in Release it only takes 3 minutes, but in relese build it modify the
original mesh and add a big hole(pleas check links to files)

What's wrong?





-------------------------------------------------------------------------------
CMakeList.txt
-------------------------------------------------------------------------------

cmake_minimum_required(VERSION 2.8.4)

project( cgal_vtk_test )

# Find CGAL
find_package(CGAL REQUIRED COMPONENTS Core) # If the dependency is required,
use REQUIRED option - if it's not found CMake will issue an error
include( ${CGAL_USE_FILE} )

# Find VTK
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})


# Setup your executable
#include_directories (BEFORE "include")

include( CGAL_CreateSingleSourceCGALProgram )
create_single_source_cgal_program( "cgal_vtk_test.cpp" ) # This will create
an executable target with name 'cgal_vtk_test'

# Add VTK link libraries to your executable target
target_link_libraries(cgal_vtk_test ${VTK_LIBRARIES})
#target_link_libraries(cgal_vtk_test)

-------------------------------------------------------------------------------
cgal_vtk_test.cpp
-------------------------------------------------------------------------------

#include <fstream>
#include <iomanip>
#include <ctime>

//
----------------------------------------------------------------------------
// CGAL
// ----------------------------------------------------------------------



#include <limits>

#include <CGAL/Polygon_mesh_processing/repair.h>
#include <CGAL/Polygon_mesh_processing/internal/repair_extra.h>
#include <CGAL/Polygon_mesh_processing/corefinement.h>


#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Surface_mesh/Surface_mesh.h>
#include <CGAL/Polygon_mesh_processing/corefinement.h>
#include <CGAL/IO/print_wavefront.h>
#include <CGAL/IO/OBJ_reader.h>
#include <CGAL/IO/print_wavefront.h>
#include <CGAL/assertions.h>

#include <CGAL/IO/STL_reader.h>
#include <CGAL/IO/STL_writer.h>


typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef CGAL::Surface_mesh<Kernel::Point_3> Mesh;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;

void addStringToFileName(std::string & fileName, const std::string & str)
{
size_t lastindex = fileName.find_last_of(".");
std::string name = fileName.substr(0, lastindex);

fileName = name + str;
}

bool repairOBJFile(std::string & fileName)
{
clock_t begin = clock();

std::cout << std::endl;
std::cout << std::endl;

std::cout <<
"..........................................................."
<< std::endl;
std::cout << ". Repairing
."
<< std::endl;
std::cout <<
"..........................................................."
<< std::endl;

std::ifstream input(fileName);
if (!input)
{
std::cerr << "Cannot open file " << std::endl;
return false;
}

std::vector<Kernel::Point_3> points;
std::vector< std::vector<std::size_t> > polygons;
if (!CGAL::read_OBJ(input, points, polygons))
{
std::cerr << "Error parsing the OFF file " << std::endl;
return false;
}
//Mesh mesh;
Polyhedron mesh;
CGAL::Polygon_mesh_processing::orient_polygon_soup(points, polygons);
CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(points,
polygons, mesh);

bool solved =
CGAL::Polygon_mesh_processing::remove_self_intersections(mesh);

if (!solved)
{
std::cout << "Some self-intersection could not be fixed" <<
std::endl;
//return false;
}

addStringToFileName(fileName, "_fixed.obj");
std::ofstream ofs(fileName);
CGAL::print_polyhedron_wavefront(ofs, mesh);

clock_t end = clock();
double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;

std::cout << std::endl;
std::cout << std::endl;

std::cout << "Repairing time:.................." << elapsed_secs << "
seconds."<< std::endl;

return true;
}

int main(int argc, char* argv[])
{
std::string fileName = argv[1];
repairOBJFile(fileName);
return 0;
}




--
Sent from: http://cgal-discuss.949826.n4.nabble.com/



Archive powered by MHonArc 2.6.18.

Top of Page