Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Distance between a point set and a point not in it or in another point set

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Distance between a point set and a point not in it or in another point set


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Distance between a point set and a point not in it or in another point set
  • Date: Wed, 26 Jan 2011 16:50:39 +0100

zaphod wrote:
Hello,

I am really a beginner with CGAL so, please, forgive my very basic question.
But I have looked in the documentation and did not find an answer.

How would it be possible to compute the distance between a point set and
another point which is not in that point set? How would it be possible to
compute the distance between two point sets (that is the distance between
their two closest points and not between their hulls)?

I have searched in the documentation but I have only found a function that
give the k closest neighbours of a point in a point set and function that
returns the distance between the convex hulls of 2 point sets but not
between their closest points.

Thank you!

For your first question using k-nearest neighbor search with k=1 will make it (insert your points in the tree and make the query with your
point). See example here:
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Spatial_searching/Chapter_main.html#Subsection_59.3.1


For the second one, a naive method is to use the first method iteratively over all the points of one set and take the pair with
smallest distance. If you have performance issues, probably filtering
points with bbox should be more efficient.

S.


Cheers,

Philippe





Archive powered by MHonArc 2.6.16.

Top of Page