Subject: CGAL users discussion list
List archive
- From: Orxan Shibliyev <>
- To:
- Subject: [cgal-discuss] Circulating through points of alpha_shape_2
- Date: Wed, 19 Dec 2018 18:57:27 -0100
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:MRBtaBMZ9p5c1I5Nrskl6mtUPXoX/o7sNwtQ0KIMzox0Lf79rarrMEGX3/hxlliBBdydt6oUzbKO+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1Ov71GonPhMiryuy+4ZLebxlLiTanfb9+MAi9oBnMuMURnYZsMLs6xAHTontPdeRWxGdoKkyWkh3h+Mq+/4Nt/jpJtf45+MFOTav1f6IjTbxFFzsmKHw65NfqtRbYUwSC4GYXX3gMnRpJBwjF6wz6Xov0vyDnuOdxxDWWMMvrRr0yRD+s7bpkSAXwhSgINzA3/mLZhNFugq1Hux+uvQBzzpTObY2JKPZzfKXQds4aS2pbWcZRUjRMDJqmb4oAFeUBO/tToZT9p1sPthS+AQisBePxxT9Wm3T72qo60/4uEA7c2gwsBckOsHTVrNruMKcSUPu4zKbNzTrZbvNW3S3x55TPchAkuPyBW697f8nJyUQ3CQ/JklGdpZbmMj6VzOgBrmmW4ut6We6yiWMqpQd8qSW1yMg2kInGnIcVx0jE9SpnxIY1IsW1SEthbt6lFJtcriCaN5drTs87TWFkpSQ3x7MctZ60eygKz5snxxrBZPCdb4eI5RfjWP6QITd+mn1lZKqyiwiu/UWk0OHxVcm53ExXoidEk9TArG0B2h7d58SfT/ty5Eah2TKB1wDJ7eFEJFg5la3BK58u2LEwkIAfsV/DHi/3g0r2iK6We14r+uit8evnY7HmqoWAOI9zjwHyKr4uldCnAeQkLggOWHCW9viz1LL5+U31WahFjvwtkqbFrZDaPt8bq7WiAw5V14Yj8wywAy2n0NQeh3kHLUhKdAiJj4jzaBnyJ6XzAv67xlitizx23OvuP7v7A5yLIGKQvq3meONa8V5VzkIIzdFV45NFB69JdPXpSkb38sfYDxU9MiS7xu/mDJN20YZICjHHObOQLK6H6QzA3ekoOeTZPNZE6ga4EOAs4rvVtVF8nFYceaez2p5OMSK3G/1nJwOSZn++245dQ1dPhRI3SanRsHPHSSRaPi/gUKc15zV9A4WjX9+aG9KdxYeZ1SL+JaV4I2BLDlfWTyXtfoSAHvYQMWece5A61DMDUrelRskq0hT87AI=
I made a test for circulating through output points of alpha_shape_2. There is a square at vertices (0 0), (10 0), (10 10), (0 10).
Obviously, `A.alpha_shape_vertices_begin()` begins with (10 0) and the incident vertex chosen by `incident_vertices` was (10, 10). Circulation was going good until I got a weird output (0.5 0.5) which should have been (10 0).
I thought that (0.5 0.5) is past-end-value although circulators have no such thing. Thats why I tried `--vccopy` to stop circulation earlier and avoid (0.5 0.5). This cheap trick works for this specific case but not in general.
I also checked edges. The same weird number (0.5 0.5) appears again.
My ultimate goal is to make a simple polygon from points returned by alpha_shape_2. Purpose of circulating is to get ordered points.
Anyone has idea why I get this weird number?
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Alpha_shape_2.h>
#include <CGAL/Alpha_shape_vertex_base_2.h>
#include <CGAL/Alpha_shape_face_base_2.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/Iso_rectangle_2.h>
#include <CGAL/Delaunay_triangulation_2.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel CGAL_kernel;
typedef CGAL_kernel::Point_2 CGAL_Point;
typedef CGAL::Alpha_shape_vertex_base_2<CGAL_kernel> Vb;
typedef CGAL::Alpha_shape_face_base_2<CGAL_kernel> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Tds;
typedef CGAL::Delaunay_triangulation_2<CGAL_kernel,Tds> Triangulation_2;
typedef CGAL::Alpha_shape_2<Triangulation_2> Alpha_shape_2;
typedef CGAL_kernel::FT FT;
typedef CGAL::Polygon_2<CGAL_kernel> Polygon_2;
int main()
{
std::deque<Polygon_2> pols;
std::vector<CGAL_Point> ptscgal;
ptscgal.push_back(CGAL_Point(0,0));
ptscgal.push_back(CGAL_Point(10,0));
ptscgal.push_back(CGAL_Point(10,10));
ptscgal.push_back(CGAL_Point(0,10));
Alpha_shape_2 A(ptscgal.begin(), ptscgal.end(), FT(10000), Alpha_shape_2::REGULARIZED);
Alpha_shape_2::Alpha_shape_vertices_iterator vit = A.alpha_shape_vertices_begin(),
vend = A.alpha_shape_vertices_end();
Alpha_shape_2::Alpha_shape_edges_iterator it = A.alpha_shape_edges_begin(),
end = A.alpha_shape_edges_end();
Triangulation_2::Vertex_circulator vc = A.incident_vertices(*vit);
Triangulation_2::Vertex_circulator vccopy = vc;
// --vccopy;
Triangulation_2::Edge_circulator ec = A.incident_edges(*vit);
Triangulation_2::Edge_circulator eccopy = ec;
do
{
std::cout << vc->point() << std::endl;
}
while(++vc != vccopy);
do
{
std::cout << "ec: " << *(ec->first->vertex(0)) << " " << *(ec->first->vertex(1)) << std::endl;
}
while(++ec != eccopy);
return 0;
}
Output:
10 10
0 10
0 0
0.5 0.5 // ??
10 0 10 10
10 0 0 10
0.5 0.5 10 0 // ??
10 10 10 0
- [cgal-discuss] Circulating through points of alpha_shape_2, Orxan Shibliyev, 12/19/2018
Archive powered by MHonArc 2.6.18.