简体   繁体   中英

How do I extract the edges from a segment delaunay graph in CGAL?

I need to find the medial axis of a concave polygon with holes. I'm using CGAL . My current approach is:

  1. Build the 2D segment delaunay graph of the polygon
  2. Extract the resulting output segments (bisectors)
  3. Test each segment to find if it's inside the polygon
  4. The resulting set of segments will form the medial axis of the polygon

I can build the SDG, and testing edges should be straight forward but I'm struggling to extract the edges of the SDG, or the corresponding Voronoi graph rather. There should be a few types of edges I'd expect: points, lines and parabolas.

How do I do this? Am I even on the right track?

Also I know I can iterate through the edges of the graph using one of the supplied methods and I understand this returns the face and opposite vertex to the edge. But how do I use this to get, say, the endpoints of a bisecting line?

You can use the functions draw_dual() or draw_skeleton() . The parabola arc will be approximated by segments. You can look at the implementation of the method if you need more control on the output.

You can use such a class for collecting objects:

struct Collector
{
  std::vector<Ray_2> rays;
  std::vector<Line_2> lines;
  std::vector<Segment_2> segs;

  void operator<<(const Ray_2& p){rays.push_back(p);}
  void operator<<(const Line_2& p){lines.push_back(p);}
  void operator<<(const Segment_2& p){segs.push_back(p);}
};

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