简体   繁体   中英

CGAL: identify "non-border" edges

I'm discovering CGAL, I tried the 3D convex hull. I tried it with the vertices of a cube, and I observed that the convex hull is a triangulation (I'm using Surface_mesh , not Polyhedron_3 ). So CGAL includes the diagonals of the faces of the cube in the list of edges. I want to identify such edges (because, for example, I don't want to plot these edges).

I expected that the function is_border would identify the other edges, but it returns false for all the edges. So what is a border?

I found a solution. I iterate over the edges and for each pair of the corresponding half-edges I take the attached face:

Mesh::Halfedge_index h0 = mesh.halfedge(ed, 0);
Mesh::Face_index face0 = mesh.face(h0);
Mesh::Halfedge_index h1 = mesh.halfedge(ed, 1);
Mesh::Face_index face1 = mesh.face(h1);

Then I compute the normals of these two faces, and I claim that the edge is a diagonal if these two normals are equal. Is it correct? That seems to work.

But my questions are:

  • what is a border, in the sense of is_border ?

  • isn't there a more convenient way to identify the "non-border" edges (ie the diagonals in the case of the cube)?

A border edge is an edge that is incident to only one face, meaning that you have a non-closed output. Obviously this cannot happen for a 3D convex hull, except if you are in a degenerate case and the point set is not 3D. You can use a geometric predicate (CGAL::coplanar() with the points of the edge and the opposite vertices of incident faces) even if we should get this information directly from the algorithm. I'll open an issue to get this information directly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM