Clip make_surface_mesh output

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

Clip make_surface_mesh output

Kim
Hi everyone,

I am trying to clip a surface mesh using a closed PolygonMesh "shell" I am
importing from an external file. The section of the code in question looks
as follows:
CGAL::make_surface_mesh(c2t3,                  // Reconstructed mesh
(output)
                        surface,               // Implicit surface
                        criteria,              // Meshing criteria
                        CGAL::Manifold_tag()); // Require manifold mesh
PolygonMesh to_be_cut;
CGAL::facets_in_complex_2_to_triangle_mesh(c2t3, to_be_cut);
bool testing = CGAL::Polygon_mesh_processing::clip(to_be_cut, shell,
CGAL::parameters::clip_volume(true).use_compact_clipper(true));

This is giving me the followin error:
terminate called after throwing an instance of
'CGAL::Precondition_exception'
  what():  CGAL ERROR: precondition violation!
Expr: CGAL::is_valid_polygon_mesh(tm)
File: ./libs/CGAL-5.1/include/CGAL/Polygon_mesh_processing/orientation.h

Since if I save the output of make_surface_mesh to a file and read the file
back in to a "PolygonMesh to_be_cut" the clipper has no problems, the
problem must lie in going from c2t3 to polygonMesh but I can't seem to
figure out how to make it work. Hopefully someone can help.

Kind regards,
Kim




--
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: Clip make_surface_mesh output

Sebastien Loriot (GeometryFactory)
Maybe you are falling on a bug already reported 3 time this week :)

Could you try calling
`CGAL::Polygon_mesh_processing::remove_isolated_vertices(to_be_cut)` ?

https://doc.cgal.org/latest/Polygon_mesh_processing/group__PMP__repairing__grp.html#ga91c02ef57e638faf2622eae93e7a25e2

It will remove isolated vertices that
facets_in_complex_2_to_triangle_mesh should not create.

A "true" fix is already on its way:
https://github.com/CGAL/cgal/pull/4990

Best regards,

Sebastien.


On 9/11/20 10:12 AM, Kim ([hidden email] via
cgal-discuss Mailing List) wrote:

> Hi everyone,
>
> I am trying to clip a surface mesh using a closed PolygonMesh "shell" I am
> importing from an external file. The section of the code in question looks
> as follows:
> CGAL::make_surface_mesh(c2t3,                  // Reconstructed mesh
> (output)
>                          surface,               // Implicit surface
>                          criteria,              // Meshing criteria
>                          CGAL::Manifold_tag()); // Require manifold mesh
> PolygonMesh to_be_cut;
> CGAL::facets_in_complex_2_to_triangle_mesh(c2t3, to_be_cut);
> bool testing = CGAL::Polygon_mesh_processing::clip(to_be_cut, shell,
> CGAL::parameters::clip_volume(true).use_compact_clipper(true));
>
> This is giving me the followin error:
> terminate called after throwing an instance of
> 'CGAL::Precondition_exception'
>    what():  CGAL ERROR: precondition violation!
> Expr: CGAL::is_valid_polygon_mesh(tm)
> File: ./libs/CGAL-5.1/include/CGAL/Polygon_mesh_processing/orientation.h
>
> Since if I save the output of make_surface_mesh to a file and read the file
> back in to a "PolygonMesh to_be_cut" the clipper has no problems, the
> problem must lie in going from c2t3 to polygonMesh but I can't seem to
> figure out how to make it work. Hopefully someone can help.
>
> Kind regards,
> Kim
>
>
>
>
> --
> 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


Kim
Reply | Threaded
Open this post in threaded view
|

Re: Clip make_surface_mesh output

Kim
That seems to indeed be the issue.

Thanks!
Kim



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