Area of polygon obtained with alpha_shape_2

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Area of polygon obtained with alpha_shape_2

orxshi
I used CGAL's alpha_shape_2 in REGULARIZED mode to get outline of set of points. I want to calculate area of the resultant shape. I tried to make a Polygon_2 from vertices obtained with Alpha_shape_vertices_iterator but it seems like the points are not ordered because is_simple for the polygon returned wrong. Segments obtained with Alpha_shape_edges_iterator are not ordered/connected as well. is_simple is important because area is ill defined without it.

Can someone share his experience with finding area of polygon obtained with alpha_shape_2?
Reply | Threaded
Open this post in threaded view
|

Re: Area of polygon obtained with alpha_shape_2

Renato
I think you should create the polygon with the returned segments by yourself, checking source and target and connecting them in the correct order. 

On Tue, Dec 18, 2018 at 7:53 AM Orxan Shibliyev <[hidden email]> wrote:
I used CGAL's alpha_shape_2 in REGULARIZED mode to get outline of set of points. I want to calculate area of the resultant shape. I tried to make a Polygon_2 from vertices obtained with Alpha_shape_vertices_iterator but it seems like the points are not ordered because is_simple for the polygon returned wrong. Segments obtained with Alpha_shape_edges_iterator are not ordered/connected as well. is_simple is important because area is ill defined without it.

Can someone share his experience with finding area of polygon obtained with alpha_shape_2?


--
Renato Silveira
     Ph.D. in Computer Science
     NTU / UFRGS | Núcleo de Tecnologia Urbana

     Porto Alegre - RS - Brazil


Reply | Threaded
Open this post in threaded view
|

Re: Area of polygon obtained with alpha_shape_2

brainslush
In reply to this post by orxshi
You can have multiple resulting polygons, e.g. polygon with a hole or
multiple disconnected polygons which all are non simple. To avoid that
you need first find the right alpha value such that you have only one
polygon and possibly remove a hole from that polygon. Also you can sort
the vertices by using points with data. Assign the points an identifier
and use the edge iterator to find the correct order.


On 18/12/18 13:52, Orxan Shibliyev wrote:

> I used CGAL's alpha_shape_2 in REGULARIZED mode to get outline of set
> of points. I want to calculate area of the resultant shape. I tried to
> make a Polygon_2 from vertices obtained with
> Alpha_shape_vertices_iterator but it seems like the points are not
> ordered because is_simple for the polygon returned wrong. Segments
> obtained with Alpha_shape_edges_iterator are not ordered/connected as
> well. is_simple is important because area is ill defined without it.
>
> Can someone share his experience with finding area of polygon obtained
> with alpha_shape_2?


--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss