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

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

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

sergio
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/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: 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

Sebastien Loriot (GeometryFactory)
No idea what you did, if I open the polyhedron demo, load your model
call orient polygon soup and remove self intersections, everything is
done in less than a minute on my computer and the output model does not
contain any self-intersection.

Do you have intermediate writing to "string" with a rounding of the
coordinates of the point not using the max precision
(std::setprecision(17) for the ostream)?

Sebastien.

On 07/04/2018 11:33 AM, sergio wrote:

> 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/
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: 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

sergio
Thanks for your fast answer! :). I set std::setprecision(17)   with the same results. Have you execute the demo with Windows? In my case I executed the program in Windows 10.

On Mon, Jul 9, 2018 at 10:27 AM, Sebastien Loriot (GeometryFactory) <[hidden email]> wrote:
No idea what you did, if I open the polyhedron demo, load your model
call orient polygon soup and remove self intersections, everything is done in less than a minute on my computer and the output model does not
contain any self-intersection.

Do you have intermediate writing to "string" with a rounding of the coordinates of the point not using the max precision (std::setprecision(17) for the ostream)?

Sebastien.


On 07/04/2018 11:33 AM, sergio wrote:
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/


--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss



Reply | Threaded
Open this post in threaded view
|

Re: 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

Sebastien Loriot (GeometryFactory)
No on linux. The precompiled demo on windows is available here:
https://www.cgal.org/demo/4.12/polyhedron_3.zip
with common dlls (to be put in the same directy as Polyhedron_3.exe
in the aforementioned archive):
https://www.cgal.org/demo/4.12/CGAL-demoDLLs.zip

Sebastien.

On 07/09/2018 11:40 AM, sergio campo wrote:

> Thanks for your fast answer! :). I set std::setprecision(17)  with the
> same results. Have you execute the demo with Windows? In my case I
> executed the program in Windows 10.
>
> On Mon, Jul 9, 2018 at 10:27 AM, Sebastien Loriot (GeometryFactory)
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     No idea what you did, if I open the polyhedron demo, load your model
>     call orient polygon soup and remove self intersections, everything
>     is done in less than a minute on my computer and the output model
>     does not
>     contain any self-intersection.
>
>     Do you have intermediate writing to "string" with a rounding of the
>     coordinates of the point not using the max precision
>     (std::setprecision(17) for the ostream)?
>
>     Sebastien.
>
>
>     On 07/04/2018 11:33 AM, sergio wrote:
>
>         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
>         <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
>         <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
>         <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
>         <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/
>         <http://cgal-discuss.949826.n4.nabble.com/>
>
>
>     --
>     You are currently subscribed to cgal-discuss.
>     To unsubscribe or access the archives, go to
>     https://sympa.inria.fr/sympa/info/cgal-discuss
>     <https://sympa.inria.fr/sympa/info/cgal-discuss>
>
>
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: 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

Zesen Qian
sorry, not try to hijack the thread, but how is this self-intersection
fix method compared to MeshFix? I'm using the latter and it can't fix
meshes with SI that's too complex.

Best,
Zesen

On Mon, Jul 9, 2018 at 5:43 AM, Sebastien Loriot (GeometryFactory)
<[hidden email]> wrote:

> No on linux. The precompiled demo on windows is available here:
> https://www.cgal.org/demo/4.12/polyhedron_3.zip
> with common dlls (to be put in the same directy as Polyhedron_3.exe
> in the aforementioned archive):
> https://www.cgal.org/demo/4.12/CGAL-demoDLLs.zip
>
> Sebastien.
>
> On 07/09/2018 11:40 AM, sergio campo wrote:
>>
>> Thanks for your fast answer! :). I set std::setprecision(17)  with the
>> same results. Have you execute the demo with Windows? In my case I executed
>> the program in Windows 10.
>>
>> On Mon, Jul 9, 2018 at 10:27 AM, Sebastien Loriot (GeometryFactory)
>> <[hidden email] <mailto:[hidden email]>> wrote:
>>
>>     No idea what you did, if I open the polyhedron demo, load your model
>>     call orient polygon soup and remove self intersections, everything
>>     is done in less than a minute on my computer and the output model
>>     does not
>>     contain any self-intersection.
>>
>>     Do you have intermediate writing to "string" with a rounding of the
>>     coordinates of the point not using the max precision
>>     (std::setprecision(17) for the ostream)?
>>
>>     Sebastien.
>>
>>
>>     On 07/04/2018 11:33 AM, sergio wrote:
>>
>>         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
>>
>> <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
>>
>> <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
>>
>> <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
>>         <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/
>>         <http://cgal-discuss.949826.n4.nabble.com/>
>>
>>
>>     --     You are currently subscribed to cgal-discuss.
>>     To unsubscribe or access the archives, go to
>>     https://sympa.inria.fr/sympa/info/cgal-discuss
>>     <https://sympa.inria.fr/sympa/info/cgal-discuss>
>>
>>
>>
>
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://sympa.inria.fr/sympa/info/cgal-discuss
>
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: 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

Sebastien Loriot (GeometryFactory)
I never used MeshFix as I don't think there is a linux version.
If you have some hard to fix self-intersections I'm interested in
having a look and I'll let you know if CGAL can fix those.
You can send me the file off list if you don't want to spam the whole list.

Thanks,

Sebastien.

On 07/10/2018 12:12 PM, Zesen Qian wrote:

> sorry, not try to hijack the thread, but how is this self-intersection
> fix method compared to MeshFix? I'm using the latter and it can't fix
> meshes with SI that's too complex.
>
> Best,
> Zesen
>
> On Mon, Jul 9, 2018 at 5:43 AM, Sebastien Loriot (GeometryFactory)
> <[hidden email]> wrote:
>> No on linux. The precompiled demo on windows is available here:
>> https://www.cgal.org/demo/4.12/polyhedron_3.zip
>> with common dlls (to be put in the same directy as Polyhedron_3.exe
>> in the aforementioned archive):
>> https://www.cgal.org/demo/4.12/CGAL-demoDLLs.zip
>>
>> Sebastien.
>>
>> On 07/09/2018 11:40 AM, sergio campo wrote:
>>>
>>> Thanks for your fast answer! :). I set std::setprecision(17)  with the
>>> same results. Have you execute the demo with Windows? In my case I executed
>>> the program in Windows 10.
>>>
>>> On Mon, Jul 9, 2018 at 10:27 AM, Sebastien Loriot (GeometryFactory)
>>> <[hidden email] <mailto:[hidden email]>> wrote:
>>>
>>>      No idea what you did, if I open the polyhedron demo, load your model
>>>      call orient polygon soup and remove self intersections, everything
>>>      is done in less than a minute on my computer and the output model
>>>      does not
>>>      contain any self-intersection.
>>>
>>>      Do you have intermediate writing to "string" with a rounding of the
>>>      coordinates of the point not using the max precision
>>>      (std::setprecision(17) for the ostream)?
>>>
>>>      Sebastien.
>>>
>>>
>>>      On 07/04/2018 11:33 AM, sergio wrote:
>>>
>>>          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
>>>
>>> <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
>>>
>>> <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
>>>
>>> <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
>>>          <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/
>>>          <http://cgal-discuss.949826.n4.nabble.com/>
>>>
>>>
>>>      --     You are currently subscribed to cgal-discuss.
>>>      To unsubscribe or access the archives, go to
>>>      https://sympa.inria.fr/sympa/info/cgal-discuss
>>>      <https://sympa.inria.fr/sympa/info/cgal-discuss>
>>>
>>>
>>>
>>
>> --
>> You are currently subscribed to cgal-discuss.
>> To unsubscribe or access the archives, go to
>> https://sympa.inria.fr/sympa/info/cgal-discuss
>>
>>
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: 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

sergio
Hello Sebastien,

Could you please let me know if you can fix this complex file?


I tried but it does not fixed it has 104106 intersected face of 104384 faces (99% of model)

Thanks and best regards,

Rubén

On Tue, Jul 10, 2018 at 5:34 PM, Sebastien Loriot (GeometryFactory) <[hidden email]> wrote:
I never used MeshFix as I don't think there is a linux version.
If you have some hard to fix self-intersections I'm interested in
having a look and I'll let you know if CGAL can fix those.
You can send me the file off list if you don't want to spam the whole list.

Thanks,

Sebastien.


On 07/10/2018 12:12 PM, Zesen Qian wrote:
sorry, not try to hijack the thread, but how is this self-intersection
fix method compared to MeshFix? I'm using the latter and it can't fix
meshes with SI that's too complex.

Best,
Zesen

On Mon, Jul 9, 2018 at 5:43 AM, Sebastien Loriot (GeometryFactory)
<[hidden email]> wrote:
No on linux. The precompiled demo on windows is available here:
https://www.cgal.org/demo/4.12/polyhedron_3.zip
with common dlls (to be put in the same directy as Polyhedron_3.exe
in the aforementioned archive):
https://www.cgal.org/demo/4.12/CGAL-demoDLLs.zip

Sebastien.

On 07/09/2018 11:40 AM, sergio campo wrote:

Thanks for your fast answer! :). I set std::setprecision(17)  with the
same results. Have you execute the demo with Windows? In my case I executed
the program in Windows 10.

On Mon, Jul 9, 2018 at 10:27 AM, Sebastien Loriot (GeometryFactory)
<[hidden email] <mailto:[hidden email]>> wrote:

     No idea what you did, if I open the polyhedron demo, load your model
     call orient polygon soup and remove self intersections, everything
     is done in less than a minute on my computer and the output model
     does not
     contain any self-intersection.

     Do you have intermediate writing to "string" with a rounding of the
     coordinates of the point not using the max precision
     (std::setprecision(17) for the ostream)?

     Sebastien.


     On 07/04/2018 11:33 AM, sergio wrote:

         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

<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

<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

<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
         <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/
         <http://cgal-discuss.949826.n4.nabble.com/>


     --     You are currently subscribed to cgal-discuss.
     To unsubscribe or access the archives, go to
     https://sympa.inria.fr/sympa/info/cgal-discuss
     <https://sympa.inria.fr/sympa/info/cgal-discuss>




--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss




--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss



Reply | Threaded
Open this post in threaded view
|

Re: 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

Zesen Qian
Hi Sergio,

I tried it for you - remove_self_intersection can't fix it. There is
still numerous intersections left.

Also FYI, MeshFix can't fix it either - the output mesh is virtually
empty with only a simple convex.

Best,
Zesen

On Tue, Jul 10, 2018 at 11:42 AM, sergio campo <[hidden email]> wrote:

> Hello Sebastien,
>
> Could you please let me know if you can fix this complex file?
>
> https://drive.google.com/open?id=1BVs6x_VGx1RMGxC1BcGf_PCe-kLoTJBc
>
> I tried but it does not fixed it has 104106 intersected face of 104384 faces
> (99% of model)
>
> Thanks and best regards,
>
> Rubén
>
> On Tue, Jul 10, 2018 at 5:34 PM, Sebastien Loriot (GeometryFactory)
> <[hidden email]> wrote:
>>
>> I never used MeshFix as I don't think there is a linux version.
>> If you have some hard to fix self-intersections I'm interested in
>> having a look and I'll let you know if CGAL can fix those.
>> You can send me the file off list if you don't want to spam the whole
>> list.
>>
>> Thanks,
>>
>> Sebastien.
>>
>>
>> On 07/10/2018 12:12 PM, Zesen Qian wrote:
>>>
>>> sorry, not try to hijack the thread, but how is this self-intersection
>>> fix method compared to MeshFix? I'm using the latter and it can't fix
>>> meshes with SI that's too complex.
>>>
>>> Best,
>>> Zesen
>>>
>>> On Mon, Jul 9, 2018 at 5:43 AM, Sebastien Loriot (GeometryFactory)
>>> <[hidden email]> wrote:
>>>>
>>>> No on linux. The precompiled demo on windows is available here:
>>>> https://www.cgal.org/demo/4.12/polyhedron_3.zip
>>>> with common dlls (to be put in the same directy as Polyhedron_3.exe
>>>> in the aforementioned archive):
>>>> https://www.cgal.org/demo/4.12/CGAL-demoDLLs.zip
>>>>
>>>> Sebastien.
>>>>
>>>> On 07/09/2018 11:40 AM, sergio campo wrote:
>>>>>
>>>>>
>>>>> Thanks for your fast answer! :). I set std::setprecision(17)  with the
>>>>> same results. Have you execute the demo with Windows? In my case I
>>>>> executed
>>>>> the program in Windows 10.
>>>>>
>>>>> On Mon, Jul 9, 2018 at 10:27 AM, Sebastien Loriot (GeometryFactory)
>>>>> <[hidden email] <mailto:[hidden email]>> wrote:
>>>>>
>>>>>      No idea what you did, if I open the polyhedron demo, load your
>>>>> model
>>>>>      call orient polygon soup and remove self intersections, everything
>>>>>      is done in less than a minute on my computer and the output model
>>>>>      does not
>>>>>      contain any self-intersection.
>>>>>
>>>>>      Do you have intermediate writing to "string" with a rounding of
>>>>> the
>>>>>      coordinates of the point not using the max precision
>>>>>      (std::setprecision(17) for the ostream)?
>>>>>
>>>>>      Sebastien.
>>>>>
>>>>>
>>>>>      On 07/04/2018 11:33 AM, sergio wrote:
>>>>>
>>>>>          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
>>>>>
>>>>>
>>>>> <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
>>>>>
>>>>>
>>>>> <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
>>>>>
>>>>>
>>>>> <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
>>>>>          <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/
>>>>>          <http://cgal-discuss.949826.n4.nabble.com/>
>>>>>
>>>>>
>>>>>      --     You are currently subscribed to cgal-discuss.
>>>>>      To unsubscribe or access the archives, go to
>>>>>      https://sympa.inria.fr/sympa/info/cgal-discuss
>>>>>      <https://sympa.inria.fr/sympa/info/cgal-discuss>
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> You are currently subscribed to cgal-discuss.
>>>> To unsubscribe or access the archives, go to
>>>> https://sympa.inria.fr/sympa/info/cgal-discuss
>>>>
>>>>
>>>
>>
>> --
>> You are currently subscribed to cgal-discuss.
>> To unsubscribe or access the archives, go to
>> https://sympa.inria.fr/sympa/info/cgal-discuss
>>
>>
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: 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

sergio
Hello Zesen, 

Thank you so much. Any ideas to solve these kind of complex files? What is the reason that they can not be fixed?
Best regards,

Sergio


On Sun, Jul 15, 2018 at 10:46 PM, Zesen Qian <[hidden email]> wrote:
Hi Sergio,

I tried it for you - remove_self_intersection can't fix it. There is
still numerous intersections left.

Also FYI, MeshFix can't fix it either - the output mesh is virtually
empty with only a simple convex.

Best,
Zesen

On Tue, Jul 10, 2018 at 11:42 AM, sergio campo <[hidden email]> wrote:
> Hello Sebastien,
>
> Could you please let me know if you can fix this complex file?
>
> https://drive.google.com/open?id=1BVs6x_VGx1RMGxC1BcGf_PCe-kLoTJBc
>
> I tried but it does not fixed it has 104106 intersected face of 104384 faces
> (99% of model)
>
> Thanks and best regards,
>
> Rubén
>
> On Tue, Jul 10, 2018 at 5:34 PM, Sebastien Loriot (GeometryFactory)
> <[hidden email]> wrote:
>>
>> I never used MeshFix as I don't think there is a linux version.
>> If you have some hard to fix self-intersections I'm interested in
>> having a look and I'll let you know if CGAL can fix those.
>> You can send me the file off list if you don't want to spam the whole
>> list.
>>
>> Thanks,
>>
>> Sebastien.
>>
>>
>> On 07/10/2018 12:12 PM, Zesen Qian wrote:
>>>
>>> sorry, not try to hijack the thread, but how is this self-intersection
>>> fix method compared to MeshFix? I'm using the latter and it can't fix
>>> meshes with SI that's too complex.
>>>
>>> Best,
>>> Zesen
>>>
>>> On Mon, Jul 9, 2018 at 5:43 AM, Sebastien Loriot (GeometryFactory)
>>> <[hidden email]> wrote:
>>>>
>>>> No on linux. The precompiled demo on windows is available here:
>>>> https://www.cgal.org/demo/4.12/polyhedron_3.zip
>>>> with common dlls (to be put in the same directy as Polyhedron_3.exe
>>>> in the aforementioned archive):
>>>> https://www.cgal.org/demo/4.12/CGAL-demoDLLs.zip
>>>>
>>>> Sebastien.
>>>>
>>>> On 07/09/2018 11:40 AM, sergio campo wrote:
>>>>>
>>>>>
>>>>> Thanks for your fast answer! :). I set std::setprecision(17)  with the
>>>>> same results. Have you execute the demo with Windows? In my case I
>>>>> executed
>>>>> the program in Windows 10.
>>>>>
>>>>> On Mon, Jul 9, 2018 at 10:27 AM, Sebastien Loriot (GeometryFactory)
>>>>> <[hidden email] <mailto:[hidden email]>> wrote:
>>>>>
>>>>>      No idea what you did, if I open the polyhedron demo, load your
>>>>> model
>>>>>      call orient polygon soup and remove self intersections, everything
>>>>>      is done in less than a minute on my computer and the output model
>>>>>      does not
>>>>>      contain any self-intersection.
>>>>>
>>>>>      Do you have intermediate writing to "string" with a rounding of
>>>>> the
>>>>>      coordinates of the point not using the max precision
>>>>>      (std::setprecision(17) for the ostream)?
>>>>>
>>>>>      Sebastien.
>>>>>
>>>>>
>>>>>      On 07/04/2018 11:33 AM, sergio wrote:
>>>>>
>>>>>          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
>>>>>
>>>>>
>>>>> <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
>>>>>
>>>>>
>>>>> <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
>>>>>
>>>>>
>>>>> <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
>>>>>          <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/
>>>>>          <http://cgal-discuss.949826.n4.nabble.com/>
>>>>>
>>>>>
>>>>>      --     You are currently subscribed to cgal-discuss.
>>>>>      To unsubscribe or access the archives, go to
>>>>>      https://sympa.inria.fr/sympa/info/cgal-discuss
>>>>>      <https://sympa.inria.fr/sympa/info/cgal-discuss>
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> You are currently subscribed to cgal-discuss.
>>>> To unsubscribe or access the archives, go to
>>>> https://sympa.inria.fr/sympa/info/cgal-discuss
>>>>
>>>>
>>>
>>
>> --
>> You are currently subscribed to cgal-discuss.
>> To unsubscribe or access the archives, go to
>> https://sympa.inria.fr/sympa/info/cgal-discuss
>>
>>
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss