Subject: CGAL users discussion list
List archive
- From: Kwok Jasper <>
- To: <>
- Subject: RE: [cgal-discuss] [HELP] about some advice related to the usage
- Date: Thu, 5 Feb 2009 19:36:16 +0800
- Importance: Normal
Thanks Actually, the reason that I want to use vector<Vertex_handle> neighbor_vertex_handle is that for each of the vertex, I want to record its k nearest neighbor (particularly, I want to record 55 nearest neighbor of a point) In the CGAL manual , I found a function that return the nearest neighbor of a vertex but I cannot find the function that return k nearest neighbor. Therefore, what I am trying now is to use the following for the k nearest neighbor search typedef Rep_class::Point_3 Point; typedef CGAL::Search_traits_3<Rep_class> Traits; typedef CGAL::Orthogonal_k_neighbor_search<Traits> Neighbor_search; typedef Neighbor_search::Tree Tree; Tree tree_for_search; vector<Point_3> neighbor; vector<Point_3>::iterator n_itr; Finite_vertices_iterator initial = Dt.finite_vertices_begin(); Finite_vertices_iterator final = Dt.finite_vertices_end(); Finite_vertices_iterator curr; Point_3 * temp; double tempX; double tempY; double tempZ; for(curr = initial; curr != final; ++curr) { tempX = (curr -> point()).x(); tempY = (curr -> point()).y(); tempZ = (curr -> point()).z(); temp = new Point_3(tempX, tempY, tempZ); tree_for_search.insert(*temp); delete temp; temp = NULL; } Neighbor_search * search; Point_3 * query; Neighbor_search::iterator itr; for(curr = initial; curr != final; ++curr) { cout << ++i << "searching neighbor" << endl; tempX = (curr -> point()).x(); tempY = (curr -> point()).y(); tempZ = (curr -> point()).z(); query = new Point_3(tempX, tempY, tempZ); search = new Neighbor_search(tree_for_search, *query, num_of_neighbor); itr = search -> begin(); ++itr; int num=0; for (; itr != search -> end(); ++itr) { ++num; if (num == 4) { curr -> fifth_nearest_dist = sqrt(itr -> second); } neighbor.push_back(itr -> first); } after that, I have a vector<Point_3> containing the coordiante of all the neighbors. Then, I get the vertex handle of the point in the triangulation having that those coordiante (I have implement a data structure to achieve this task ) After that, I push those vertex_handle of the neighbor into the vector<Vertex_handle> of the vertex currently being processed. May I ask if the above approach has used CGAL improperly that I get the exception that I have mentioned in the previous email ? Thank you very much. > Date: Wed, 4 Feb 2009 18:13:26 +0100 > From: > To: > Subject: Re: [cgal-discuss] [HELP] about some advice related to the usage > > Kwok Jasper wrote: > > > In the class Vertex_base_for_ssr, it has the member > > vector<Vertex_handle> neighbor_vertex_handle > > > > I have first insert points into a Triangulation, then > > for eac h vertex in the triangulation, I set its neighbor_vertex_handle > > to contain the vertex handle of the its neighbor points > > Is there a specific reason why you want to store the neighbors in the > vertex? > > The triangulation already stores the information, it seems redundant to > me to store it twice, unless you have a strong reason to do so. > (also, how are you going to update this information each time it changes > when you insert new points...?) > > You can easily access the information on adjacent vertices stored by the > triangulation and traverse the neighbors of a vertex: > just use t.incident_vertices() that gives you an outputiterator (see > reference manual of Triangulation_3) > > -- > You are currently subscribed to cgal-discuss. > To unsubscribe or access the archives, go to > https://lists-sop.inria.fr/wws/info/cgal-discuss 內在氣質才是致勝之道-您是哪一 最原始的溝通是用心的交流。 |
- [cgal-discuss] [HELP] about some advice related to the usage of the derived class of CGAL::Triangulation_vertex_base_3<GT>, Kwok Jasper, 02/04/2009
- Re: [cgal-discuss] [HELP] about some advice related to the usage, Monique Teillaud, 02/04/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage, Kwok Jasper, 02/05/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/07/2009
- Re: [cgal-discuss] [HELP] about some advice related to the usage of, Laurent Rineau (GeometryFactory), 02/07/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/08/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/08/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/09/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/10/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/10/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/10/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/10/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/09/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/08/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/08/2009
- Re: [cgal-discuss] [HELP] about some advice related to the usage of, Laurent Rineau (GeometryFactory), 02/07/2009
- Re: [cgal-discuss] [HELP] about some advice related to the usage of, Laurent Rineau (GeometryFactory), 02/10/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/11/2009
- Re: [cgal-discuss] [HELP] about some advice related to the usage, Monique Teillaud, 02/04/2009
Archive powered by MHonArc 2.6.16.