CGAL / cgal

The public CGAL repository, see the README below
https://github.com/CGAL/cgal#readme
Other
4.89k stars 1.38k forks source link

PMP::extrude_mesh with only edges #6463

Open Supranaturaler opened 2 years ago

Supranaturaler commented 2 years ago

Issue Details

I want to extrude some connected segments along one directon to construct surface. I use CGAL::Polygon_mesh_processing::extrude_mesh to do this. When I run this code, I got vector subscript out of range.

Source Code

#include "CGAL/Exact_predicates_exact_constructions_kernel.h"
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef Kernel::Point_3 Point_3;

#include "CGAL/Surface_mesh.h"
typedef CGAL::Surface_mesh<Point_3> SurfaceMesh;

#include "CGAL/Polygon_mesh_processing/extrude.h"
#include "CGAL/draw_surface_mesh.h"

int main(int argc, char* argv[])
{
    SurfaceMesh surfaceMesh;
    SurfaceMesh::Vertex_index index1 = surfaceMesh.add_vertex(Point_3(0, 0, 0));
    SurfaceMesh::Vertex_index index2 = surfaceMesh.add_vertex(Point_3(1, 0, 0));
    SurfaceMesh::Vertex_index index3 = surfaceMesh.add_vertex(Point_3(1, 1, 0));
    surfaceMesh.add_edge(index1, index2);
    surfaceMesh.add_edge(index2, index3);
    CGAL::draw(surfaceMesh);

    SurfaceMesh extrudedSurfaceMesh;
    CGAL::Polygon_mesh_processing::extrude_mesh(surfaceMesh, extrudedSurfaceMesh, Vector_3(0, 0, 1));
    CGAL::draw(extrudedSurfaceMesh);

    return EXIT_SUCCESS;
}

Environment

sloriot commented 2 years ago

While it could be probably be extended, the code expects that there is at least one incident face per edge.