change behavior when soup is not orientable in the demo.

This commit is contained in:
Maxime Gimeno 2019-06-17 14:11:32 +02:00
parent c5174f693c
commit 86ca13a388
2 changed files with 33 additions and 36 deletions

View File

@ -133,7 +133,7 @@ class Io_3mf_plugin:
names.clear(); names.clear();
all_colors.clear(); all_colors.clear();
int nb_meshes = int nb_meshes =
CGAL::read_soups_from_3mf(fileinfo.filePath().toUtf8().toStdString(), CGAL::read_triangle_soups_from_3mf(fileinfo.filePath().toUtf8().toStdString(),
all_points, all_polygons, all_colors, names); all_points, all_polygons, all_colors, names);
if(nb_meshes <0 ) if(nb_meshes <0 )
{ {
@ -151,10 +151,8 @@ class Io_3mf_plugin:
ok = PMP::orient_polygon_soup(points, triangles); ok = PMP::orient_polygon_soup(points, triangles);
if(!ok) if(!ok)
{ {
std::cerr<<"Object is not orientable. Skipped."<<std::endl; std::cerr<<"Object was not directly orientable, some vertices have been duplicated."<<std::endl;
} }
else
{
SMesh mesh; SMesh mesh;
PMP::polygon_soup_to_polygon_mesh(points, triangles, mesh); PMP::polygon_soup_to_polygon_mesh(points, triangles, mesh);
CGAL::Color first = colors.front(); CGAL::Color first = colors.front();
@ -187,7 +185,6 @@ class Io_3mf_plugin:
if(add_to_scene) if(add_to_scene)
CGAL::Three::Three::scene()->addItem(sm_item); CGAL::Three::Three::scene()->addItem(sm_item);
} }
}
ok = true; ok = true;
return result; return result;
} }

View File

@ -18,15 +18,15 @@
// //
// Author(s) : Maxime Gimeno // Author(s) : Maxime Gimeno
#ifndef WRITE_3MF_H #ifndef CGAL_IO_WRITE_3MF_H
#define WRITE_3MF_H #define CGAL_IO_WRITE_3MF_H
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <string> #include <string>
#include <CGAL/IO/Color.h> #include <CGAL/IO/Color.h>
#include "Model/COM/NMR_DLLInterfaces.h" #include <Model/COM/NMR_DLLInterfaces.h>
namespace CGAL{ namespace CGAL{
namespace tmf_internal{ namespace tmf_internal{
@ -465,4 +465,4 @@ bool write_triangle_meshes_to_3mf(const std::string& file_name,
return write_triangle_soups_to_3mf(file_name, all_points, all_polygons, names); return write_triangle_soups_to_3mf(file_name, all_points, all_polygons, names);
} }
}//end CGAL }//end CGAL
#endif // WRITE_3MF_H #endif // CGAL_IO_WRITE_3MF_H