Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Re: How to change Kd-Tree Point extra info
- Date: Thu, 05 Jan 2012 11:06:48 +0100
cnng0315 wrote:
Dear Loriot : thanks for your reply,it really helped me a lot. Before your reply , I
have been confused for days about this. I intended to search the tree many times with the same query point, and
each time I get the result point, I changed its extra info "bUsed", so that
the next search won't get it. After reading your reply, I understood the Kd-Tree tree and the
NN_incremental_search NN are completely diffent things. NN copys the tree,
so I chaned NN's extra info, but it dosen't change the kd-tree's extra info. I always thouht NN just pointers of tree's point. Did I get right meaning?
No, the tree is not copied, a reference to it is kept.
But the value type of iterators is Point_with_transformed_distance
( pair<Point,FT> ) thus the reference on the point you get is an
internal copy of the point.
Tree::iterator iterS_tree = tree.begin();My answer in the previous email was incorrect, the info is indeed not modified.
for (;iterS_tree!=tree.end();++iterS_tree)
{
std::cout <<iterS_tree->x() <<"," << iterS_tree->y() <<","
<<iterS_tree->z() <<","<<iterS_tree->bUsed<<std::endl;
}
It seemd there was no way to change tree's point extra info.
One solution is to use the solution with the property maps I suggested
with a pointer on the points so that the nearest neighbor classes make
copies of the pointers and not of the points (or use integers as in the
example in subsection "Using a Model of L-value Property Map Concept").
Sebastien.
But it dosen't matter, I changed the code,
for (int i=0;i<10;i++)
{
std::cout<<std::endl;
NN_positive_x_iterator
it(NN.end(),point_not_used(),NN.begin()),end(NN.end(),point_not_used());
//each time, I get different result with the same query point. for (int j=0;(j<nK)&&(it!=end);++j,++it)
{
const Point& p = (*it).first;
Point& pp = const_cast<Point&>(p);
pp.bUsed = false;
std::cout << p.x() <<" "<< p.y() << " " << p.z() <<std::endl;
}
}
oh,thank god and you, it seemd easy, but I just began to use CGAL for a
few months, it seemd hard for me . anyway, cgal is realy powerful . Are you familar with CGAL's 3d part, the demos of 3d need Geomview, but
I have compiled Geomview in windows in Cygwin. but it failed, always,faild. can you give me some suggestions about how to learn cgal's 3d . Without the
demos, i don't know what the pdf help says. I am from China, english and
math are two big problems for me. I studied Gis andEngineering Surveying in
college, and has been do the objectarx (AutoDesk, that's why there were
errors in my code when you compile it) for years.
I found you are skilled with cgal, how many years have you been with
it?
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/How-to-change-Kd-Tree-Point-extra-info-tp4264449p4264718.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] How to change Kd-Tree Point extra info, 421232206, 01/05/2012
- Re: [cgal-discuss] How to change Kd-Tree Point extra info, Sebastien Loriot (GeometryFactory), 01/05/2012
- [cgal-discuss] Re: How to change Kd-Tree Point extra info, cnng0315, 01/05/2012
- Re: [cgal-discuss] Re: How to change Kd-Tree Point extra info, Sebastien Loriot (GeometryFactory), 01/05/2012
- [cgal-discuss] Re: How to change Kd-Tree Point extra info, cnng0315, 01/06/2012
- Re: [cgal-discuss] Re: How to change Kd-Tree Point extra info, Sebastien Loriot (GeometryFactory), 01/05/2012
- [cgal-discuss] Re: How to change Kd-Tree Point extra info, cnng0315, 01/05/2012
- Re: [cgal-discuss] How to change Kd-Tree Point extra info, Sebastien Loriot (GeometryFactory), 01/05/2012
Archive powered by MHonArc 2.6.16.