Subject: CGAL users discussion list
List archive
- From: Markus Eich <>
- To:
- Subject: [cgal-discuss] Convert Alpha-Segments to an ordered Polygon
- Date: Sun, 05 Jun 2011 16:22:15 +0200
Dear all,
I am using CGAL in order the get one or more alpha polygons from a shape. IN a first approach I assume there are no holes. I generate the segements as follows:
Alpha_shape_2 as(lp.begin(),lp.end());
// find optimal alpha value
Alpha_iterator opt = as.find_optimal_alpha(1);
as.set_alpha((*opt)*2.0f);
as.set_mode(Alpha_shape_2::REGULARIZED);
std::vector<K::Segment_2> segments;
std::vector<K::Segment_2> sorted_segments;
for(Alpha_shape_edges_iterator it = as.alpha_shape_edges_begin();it != as.alpha_shape_edges_end(); ++it)
segments.push_back(as.segment(*it));
std::cout << segments.size() << " alpha shape edges" << std::endl;
This works fine an I get all the segments. My problem is that I need a single polygon (in my example I only have one concave shape). If I iterate over the std::vector<K::Segment_2> segments vector, the segments are like E,A,V,D,C,F , instead of A,B,C,D,E,F. In need the segments in an ordered way i.e. that the .target() of A is the .source() of B, the .target() of B the source of C, and so on.
How can I achieve this using CGAL? Is there a way to sort the segments directly?
Thank you and cheers,
Markus
--
Dipl. Inf. Markus Eich
Researcher
DFKI Bremen
Robotics Innovation Center
Mary-Somerville-Str. 9
28359 Bremen, Germany
Phone: +49 (0)421 17845-4105
Fax: +49 (0)421 17845-4150
E-Mail:
Weitere Informationen: http://www.dfki.de/robotik
-----------------------------------------------------------------------
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.: DE 148646973
Steuernummer: 19/673/0060/3
-----------------------------------------------------------------------
- [cgal-discuss] Convert Alpha-Segments to an ordered Polygon, Markus Eich, 06/05/2011
- Re: [cgal-discuss] Convert Alpha-Segments to an ordered Polygon, Sebastien Loriot (GeometryFactory), 06/06/2011
- Re: [cgal-discuss] Convert Alpha-Segments to an ordered Polygon, Markus Eich, 06/06/2011
- Re: [cgal-discuss] Convert Alpha-Segments to an ordered Polygon, Andreas Fabri, 06/06/2011
- Re: [cgal-discuss] Convert Alpha-Segments to an ordered Polygon, Markus Eich, 06/06/2011
- Re: [cgal-discuss] Convert Alpha-Segments to an ordered Polygon, Andreas Fabri, 06/06/2011
- Re: [cgal-discuss] Convert Alpha-Segments to an ordered Polygon, Markus Eich, 06/06/2011
- Re: [cgal-discuss] Convert Alpha-Segments to an ordered Polygon, Andreas Fabri, 06/06/2011
- Re: [cgal-discuss] Convert Alpha-Segments to an ordered Polygon, Markus Eich, 06/06/2011
- Re: [cgal-discuss] Convert Alpha-Segments to an ordered Polygon, Sebastien Loriot (GeometryFactory), 06/06/2011
Archive powered by MHonArc 2.6.16.