Subject: CGAL users discussion list
List archive
- From: Yaoyu Hu <>
- To:
- Subject: [cgal-discuss] Isotropic remeshing failed with is_valid_polygon_mesh()
- Date: Sun, 6 Sep 2020 00:47:31 -0400
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:BpBu5B2JCnU1n3Q4smDT+DRfVm0co7zxezQtwd8ZseIeI/ad9pjvdHbS+e9qxAeQG9mCtbQd0bad4/mocFdDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZrKeTpAI7SiNm82/yv95HJbAhEmTuwbalvIBmoogjducobjZZ/Iast1xXFpWdFdf5Lzm1yP1KTmBj85sa0/JF99ilbpuws+c1dX6jkZqo0VbNXAigoPGAz/83rqALMTRCT6XsGU2UZiQRHDg7Y5xznRJjxsy/6tu1g2CmGOMD9UL45VSi+46ptVRTnjzoJNyMi8GHPlMN/kL5brhympxx62YHUYYeVP+d6cq7Sed4WQGxMVdtTWSNcGIOxd4QAAeoPM+hbsofzuUcBoAC7BQWwHu7i0CNEimP00KA8zu8vERvG3AslH98WsnvbttL1NacPUeuozqfI0CjIYvRW2Tfg6InHaBchoPGRXb5tdcfcykgiGhjKjlWVs4PlPjeV2v4RvGic6uptTOSigHMopA9tuDag3NssipXXiYIPzFDJ7Th0zogrKNC5VkJ3f8CpHZhfuSyaN4V7XMMsTmNrtSomybALpYK2cScJxZkpxhPSa/yJfpSK7x7+VOucISl0iXBjdbmiiRiy9k2gxff9VsmyyFtFsiVFncPItnwX0BzT8MeHRuNy/kem3jaP2ATT5f9eLU8okqrbLpgsyaMzmJoLqUnPADP6lUHsgKKVdkgo4PWk5/rkb7n8qZKQKol5gRzkPKs0gMywG+E4PxAOX2eF/eS806Xu/UjjT7VLiv06i6fYsJXHKcgCqK60DBJZ3pws6xa4CDem39AYkmcdIF1ZfxKHipDlO1DIIP/mEfeym0qgnCtvyvzcPbDsAo/BImXdnLriZ7pw5FNQxBI2zd9F5pJUDr8BIOj0Wk/0rNHYDgI5MgyuzObgCNR9y54SVGaMD6KYK67SvlqI6fguI+mIfoMapDH9K/096/70kXA5gUMdfbWu3ZYPdH+4Ee5pI0GAbXXxg9cBCnsFvhclTOzxk1CCSj5SZ3OqX60m/D07CYSmDZ3CRo+3mrCB0j27TdVqYTVNBVmIVHvpbI6ZQOwkaSSII8YnnCZXe6KmTtoQ3Ba/qUfa1vIzLvfF8yoJqMuyhIZd6OjalBV0/jtxWZfOm1qRRn15yztbDwQ927py9BAskwbR4e1Dm/VdUOdrybZMWwY+O4TbyrUjWd/3UwPFONyOTQT/G4n0MXQKVts0huQ2TQNlAdz710LM2iOrB/kekLnZXMVpoJKZ5GD4IoNG81iD1KQliAN7EM5GNGnjmasmsgaPXsjGlEKWk6vsfqMZjnbA
Hi,
I was trying to use CGAL::Polygon_mesh_processing::isotropic_remeshing() to remesh a CGAL::Surface_mesh. However, I got the following error message:
========== Error message begins. ==========
terminate called after throwing an instance of 'CGAL::Assertion_exception'
what(): CGAL ERROR: assertion violation!
Expr: is_valid_polygon_mesh(mesh_)
File: /home/yaoyu/Libraries/cgal/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h
Line: 1037
what(): CGAL ERROR: assertion violation!
Expr: is_valid_polygon_mesh(mesh_)
File: /home/yaoyu/Libraries/cgal/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h
Line: 1037
========== Error message ends. ==========
I was trying the code listed at https://doc.cgal.org/latest/Polygon_mesh_processing/Polygon_mesh_processing_2isotropic_remeshing_example_8cpp-example.html and I enclosed the source file. I am not sure about the reason why CGAL thinks the Surface_mesh is not a valid polygon mesh.
The input mesh is in PLY format and you could find the file at https://drive.google.com/file/d/1Z9AMfRnbkJGmDuUOc7ZAdMAvbhhhx_Vn/view?usp=sharing
One thing that might be interesting is that if I use the CGAL Polyhedron Demo program to load and do the isotropic remeshing, no errors are encountered.
Any comments are appreciated.
Thank you!
Yaoyu
// // Created by yaoyu on 9/6/20. // #include <fstream> #include <iostream> #include <string> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Polygon_mesh_processing/remesh.h> #include <CGAL/Surface_mesh.h> // Namespace. namespace PMP = CGAL::Polygon_mesh_processing; // CGAL typedefs. typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel_t; typedef Kernel_t::Point_3 Point3_t; typedef CGAL::Surface_mesh<Point3_t> SurfaceMesh_t; typedef boost::graph_traits< SurfaceMesh_t >::face_descriptor DescFace_t; typedef boost::graph_traits< SurfaceMesh_t >::edge_descriptor DescEdge_t; typedef boost::graph_traits< SurfaceMesh_t >::halfedge_descriptor DescHalfedge_t; typedef boost::graph_traits< SurfaceMesh_t >::vertex_descriptor DescVert_t; template < typename PT > void read_mesh_ply(const std::string &fn, CGAL::Surface_mesh<PT> &sm ) { std::ifstream ifs { fn }; if ( !ifs ) { std::stringstream ss; ss << "Cannot open " << fn << " for reading. "; throw std::runtime_error( ss.str() ); } if ( !CGAL::read_ply( ifs, sm ) ) { std::stringstream ss; ss << "read_ply() from " << fn << " failed. "; throw std::runtime_error( ss.str() ); } ifs.close(); } struct halfedge2edge { halfedge2edge(const SurfaceMesh_t &m, std::vector<DescEdge_t> &edges) : m_mesh(m), m_edges(edges) {} void operator()(const DescHalfedge_t &h) const { m_edges.push_back(edge(h, m_mesh)); } const SurfaceMesh_t& m_mesh; std::vector<DescEdge_t>& m_edges; }; static void isotropic_remesh( SurfaceMesh_t &mesh, double targetLength, int iters ) { // Border. std::cout << "Split border...\n"; std::vector<DescEdge_t> border; PMP::border_halfedges(faces(mesh), mesh, boost::make_function_output_iterator(halfedge2edge(mesh, border))); PMP::split_long_edges(border, targetLength, mesh); // Perform smooth. std::cout << "Start remeshing... \n"; PMP::isotropic_remeshing( faces( mesh ), targetLength, mesh, PMP::parameters::number_of_iterations(iters) .protect_constraints(true) ); } int main( int argc, char **argv ) { std::cout << "Hello, RemeshingTest! \n"; // Load the mesh from the PLY file. SurfaceMesh_t mesh; read_mesh_ply( argv[1], mesh); // Remesh. isotropic_remesh( mesh, 0.02, 1 ); return 0; }
- [cgal-discuss] Isotropic remeshing failed with is_valid_polygon_mesh(), Yaoyu Hu, 09/06/2020
- [cgal-discuss] Fwd: Isotropic remeshing failed with is_valid_polygon_mesh(), Yaoyu Hu, 09/06/2020
- Re: [cgal-discuss] Isotropic remeshing failed with is_valid_polygon_mesh(), Sebastien Loriot (GeometryFactory), 09/07/2020
- Re: [cgal-discuss] Isotropic remeshing failed with is_valid_polygon_mesh(), Yaoyu Hu, 09/07/2020
- Re: [cgal-discuss] Isotropic remeshing failed with is_valid_polygon_mesh(), Sebastien Loriot (GeometryFactory), 09/08/2020
- Re: [cgal-discuss] Isotropic remeshing failed with is_valid_polygon_mesh(), Yaoyu Hu, 09/08/2020
- Re: [cgal-discuss] Isotropic remeshing failed with is_valid_polygon_mesh(), Andreas Fabri, 09/09/2020
- Re: [cgal-discuss] Isotropic remeshing failed with is_valid_polygon_mesh(), Yaoyu Hu, 09/09/2020
- Re: [cgal-discuss] Isotropic remeshing failed with is_valid_polygon_mesh(), Andreas Fabri, 09/09/2020
- Re: [cgal-discuss] Isotropic remeshing failed with is_valid_polygon_mesh(), Yaoyu Hu, 09/08/2020
- Re: [cgal-discuss] Isotropic remeshing failed with is_valid_polygon_mesh(), Sebastien Loriot (GeometryFactory), 09/08/2020
- Re: [cgal-discuss] Isotropic remeshing failed with is_valid_polygon_mesh(), Yaoyu Hu, 09/07/2020
Archive powered by MHonArc 2.6.19+.