Subject: CGAL users discussion list
List archive
[cgal-discuss] using nearest_vertex() for triangulation of a set of points with info
Chronological Thread
- From: parisa rahmani <>
- To: "" <>
- Subject: [cgal-discuss] using nearest_vertex() for triangulation of a set of points with info
- Date: Thu, 26 May 2016 08:56:37 +0000 (UTC)
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:sjQ11RVyiMUX2AkrapXjehZB5qTV8LGtZVwlr6E/grcLSJyIuqrYZxaCt8tkgFKBZ4jH8fUM07OQ6PCxHzBdqb+681k8M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJPK/jvHcaK1oLsh7H0p8CbSj4LrQT+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf9d32JiKAHbtR/94sCt4MwrqHwI6Lob/NBMGYnzY6lwRLpfCT0iIih1vpSq5lH/Sl7F7XQVViAakwFDHhPexBD8RJb49CXg/KIp0yaTOYj6TKs/RC+5x6ZtUh7hzikdYW0D/XnTm/B32bpSuhO6rlRlyo7RaYeUfK5kd6PqZdoAbXtIXsFWESdGB9XvQZEICr8ZNPxZtIC1vVIOqBK4BEH4Hurv/SdBnFfn1K091KIqFgSQj19oJM4HrHmB9Ia9D6wVS+3glvDF
Hi,
In the first version of my code, I have a set of points for which the Delaunay triangulation is constructed. After that for each point, the nearest vertices are found. This code works fine.
In the next code, I want each point to have an index, so that in finding the neighbors, instead of coordinates of points, I want to get the index of neighbor points. So, I must use <CGAL/Triangulation_vertex_base_with_info_2.h>. But It seems that vertex handle cannot be used with these new points which have info. The code is as follows:
#include <vector>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_vertex_base_with_info_2.h>
using namespace std();
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef CGAL::Triangulation_vertex_base_with_info_2<unsigned int, Kernel> Vb;
typedef CGAL::Triangulation_data_structure_2<Vb> Tds;
typedef CGAL::Delaunay_triangulation_2<Kernel, Tds> Triangulation;
typedef Triangulation::Edge_iterator Edge_iterator;
typedef Triangulation::Point Point;
typedef Triangulation::Vertex_handle Vertex_handle;
typedef Triangulation::Vertex_circulator Vertex_circulator;
typedef Kernel::Point_2 Point_2;
typedef std::vector<std::pair<Point_2, unsigned> > Vector;
const int N = 16;
int main(){
Vector points;
points.reserve(N);
.... {Some part of code which assignes values to dir[N][2]}
for (int i = 0; i < N; i++)
points.push_back(make_pair(Point_2(dir[i][0], dir[i][1]), i));\\ I want each point to have an index
Triangulation T;
T.insert(points.begin(), points.end());
cout << T.number_of_vertices() <<endl;
for(int i = 0; i < N; i++){
Vertex_handle handle = T.nearest_vertex(points[i]);
cout<<"incidents: \n" <<endl;
cout << handle->point() <<endl<<endl;
Vertex_circulator circulator = T.incident_vertices(handle), done(circulator);
do
{
if( !T.is_infinite ( circulator))
cout << circulator->point() << endl;
cout << circulator->info()<<endl; //I haven't checked this line yet. Because of the errors in upper lines I can't get to this line.
} while(++circulator != done);
}
return 0;}
and the following error appears:
error: no matching function for call to
CGAL::Delaunay_triangulation_2 > >::nearest_vertex(std::pair,
unsigned int>&)’
- [cgal-discuss] using nearest_vertex() for triangulation of a set of points with info, parisa rahmani, 05/26/2016
Archive powered by MHonArc 2.6.18.