Search code examples
c++geometrycomputational-geometrymeshcgal

how to convert planar mesh to arrangement in CGAL


I need to convert 2d planar polygonal meshes to 2D Arrangements in CGAL. for example if I have the following mesh in Wavefront obj format:

v -5.687006 -4.782805 0.000000

v 4.878987 -4.782805 0.000000

v -5.687006 4.782805 0.000000

v 4.878987 4.782805 0.000000

v -0.404010 -4.782805 0.000000

v -5.687006 0.000000 0.000000

v 4.878987 0.000000 0.000000

v -0.404010 4.782805 0.000000

v -0.404010 0.000000 0.000000

f 5 2 9

f 9 2 7

f 7 4 9

f 9 4 8

f 8 3 9

f 9 3 6

f 6 1 9

f 9 1 5

what is the simplest way I could convert it to a 2d Arrangement using the CGAL library?


Solution

  • Using the following example, you'll find out.

    • insert_in_face_interior for the first segment
    • insert_from_left_vertex or insert_from_right_vertex for the middle one, depending on the orientation of your polygon.
    • insert_at_vertices for the last one