Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Isotropic remeshing failed with is_valid_polygon_mesh()

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Isotropic remeshing failed with is_valid_polygon_mesh()


Chronological Thread 
  • From: Yaoyu Hu <>
  • To:
  • Subject: Re: [cgal-discuss] Isotropic remeshing failed with is_valid_polygon_mesh()
  • Date: Mon, 7 Sep 2020 12:54:16 -0400
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:loPB9R9IS3PG2/9uRHKM819IXTAuvvDOBiVQ1KB+0+0eIJqq85mqBkHD//Il1AaPAdyFrase16GG6ujJYi8p2d65qncMcZhBBVcuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6JvjvGo7Vks+7y/2+94fcbglVhTexe65+IAu5oAnetcQanJZpJ7osxBfOvnZGYfldy3lyJVKUkRb858Ow84Bm/i9Npf8v9NNOXLvjcaggQrNWEDopM2Yu5M32rhbDVheA5mEdUmoNjBVFBRXO4QzgUZfwtiv6sfd92DWfMMbrQ704RSiu4qF2QxDvlSkHKiU58HnJhcNskKJVrhWhpxllzI7VZoGeKf5yc6zZcN8fQ2dKQ8RfWDFbAo6kYIQPAegOM+ZWoYf+ulUAswexCBK2C+/z0DJFnGP60bE43uknDArI3BYgH9ULsHnMrtr6LqASUOCozKLVzzvDcu5d1DD96IjVchEuu/aMXLJtccbMzUQiFALIg06fqYzgJTyV1+ANv3KH4OpnUOKikmgqoBx+rTaz3MkjkJXJhp4LxVDe8yV02IU4KcO2RkN1fdKpEZVeuiCEOoZ5Tc4vR31ltigmx7MItpC2fycExIkkyhPfdvCKc5aF7w7tWuuVLjl1h31odbO5ih2v/0agzej8WdO10FZMtidFnd7MtncC1xzX9MeLUOdy/kCk2TqXyw/T5ftLIUQumarcMZ4hzaY8lpsVsUTZHy/5gl/6jKGMdkgi5+Om6Pznb634qpOAM4J4kALzP6Q0lsChH+g0LxICUmef9Om6ybbt51f2QK9Qgf0ziqTZsI7VJcAcpqOhBg9ayIcj6xKmAzaoytQUgGALLFxKdR+DlYTpNFbOIPf3Dfe7nVugiitkx/fDPrH5A5XNKGbMkKv5cLpj90JRzBA/wNNf6p5OFL0NPu//VlX+udHcFhM5Nha7w+fjCNVzzIMeXmePD7eZMKPPsV6H/OUvIumRZIMIvDvwKPko6uXhjX88g1AdfK2p0YELZ3C/G/RqO1+Zbmb0gtcdDWcKuRIzQ/DliFKYVT5ffmu9X6Mn5j4nFYKmFpzDS5u2gL2B2Se7BodZanpHClCKC3fodp+LV+0CaCKIcYdclCcZX+2hV5M5zkPp8xTrzqJuaOvS4CwR85z5k8Nk4vXa0hA0+zszBMuU1ySBTnp/g3gTFAIwx711gVB4zgKDzbRgmK4fUsdC4utAFAY8L5/VieJgTMvjXxrIOdaPRlHhSdqvBXQ9T8k63sQVMHt7AMiosh3Tw3+qH6MNjO7MQ4cl97rVmXn3Pcd0jXjck7IwikEvBcpJO2rhjaF2803fBpXCjl6CxJqtIK8T1SqI+GaYxneVp2lZVhRxWOPLRyMxfEzT+OXw4VLfB5+zQeAnLxpIzt+fc/oaNPXmiFxHQLHoP9GIMDH5oHu5GRvdnuDEV4HtYWhIgHSEVRo01jsL9HPDDjAQQyesp2WEUW5rHFPrJlz2qKxw9CL9QUgzwAWHKUZm0ujto09HtbmnU/oWm4k8lmIkojRwEky62ouPWdWFrgtlOq5bZIFkuQsV5SfirwV4e6eYAeV6nFdHKlZ4ukrv01N8DYASycU=

Hi Sebastien,

Thank you for your reply. I tried to use CGAL::is_valid_polygon_mesh(), it indeed returns false. However, I do not know how to visualize the content in the CGAL::Verbose_ostream, then I manually stepped into the source code. I found that the check fails inside is_valid_halfedge_graph() which is defined in cgal/BGL/include/CGAL/boost/graph/helpers.h . The actual place that triggers the failure is the following code section

========== Code section begins. ==========

for(vertex_descriptor vbegin : vertices(g))
  {
    // Pointer integrity.
    if(halfedge(vbegin, g) != boost::graph_traits<Graph>::null_halfedge())
      valid = (target(halfedge(vbegin, g), g) == vbegin);
    else
      valid = false;

    if(!valid)
    {
      verr << "vertex " << v << " halfedge incident to vertex is the null halfedge." << std::endl;
      verr << "Halfedge Graph Structure is NOT VALID." << std::endl;
      return false;
    }

.....other codes..........
}

========== Code section ends. ==========

The v value is 12718 for this particular mesh. (mesh link: https://drive.google.com/file/d/1Z9AMfRnbkJGmDuUOc7ZAdMAvbhhhx_Vn/view?usp=sharing )

The input mesh, as I provided in the previous email and as the above link, is a resulting mesh from the advancing front surface reconstruction of CGAL (I wrote another separate piece of code to do that). The reconstructed mesh was saved to the file system with CGAL::write_ply() function. This mesh can be processed by the Polyhedron Demo program which performs isotropic remeshing without any warnings or errors. 

What should I do to make the mesh a valid polygon mesh? Is there a way to fix this situation? I tried to remove the self-intersection facets by first using CGAL::Polygon_mesh_processing::self_intersections() and then CGAL::Euler::remove_face(). Additionally, I tried CGAL::Polygon_mesh_processing::duplicate_non_manifold_vertices(). No intersections and no non-manifold vertices are found. But the mesh is still not valid.

I may try to look into the vertex 12718 ( if using 0-based indexing, it is 12717 I suppose ) and try to figure out what makes this vertex so special.

Hoping to get more insights into the problem from your help.

Regards,

Yaoyu

On Mon, Sep 7, 2020 at 12:50 AM "Sebastien Loriot (GeometryFactory)" <> wrote:
Could you check the value returned by
CGAL::is_valid_polygon_mesh(my_mesh) called on your mesh before calling
the CGAL function? It might be that the input is not a valid polygon
mesh (non-manifold vertices for example).

Thanks,

Sebastien.



On 9/6/20 6:47 AM, Yaoyu Hu ( via cgal-discuss
Mailing List) wrote:
> 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
>
> ========== 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
>
> --
> 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





Archive powered by MHonArc 2.6.19+.

Top of Page