Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Hash function for the Plane_3 class

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Hash function for the Plane_3 class


Chronological Thread 
  • From: Marc Glisse <>
  • To:
  • Subject: Re: [cgal-discuss] Hash function for the Plane_3 class
  • Date: Fri, 27 Apr 2018 23:02:12 +0200 (CEST)

On Fri, 27 Apr 2018, houes wrote:

Marc,

Thanks for the reply. I am using Epick.

The planes are created separately. For example, a pentagon in a 3D plane has
5 vertices. I might use any 3 vertices of it to define a 3D plane. Such
planes should be identical. And if there are two such planes, I need to
remove them.

Well, you are in trouble because of the 'i' in Epick. You constructed a Plane_3, and even assuming that your points are exactly coplanar (not that likely), that construction was not exact. Even using the same 3 points in a different order might yield a slightly different plane.

If we assume that you were lucky and your Plane_3 are equivalent, you could consider hashing or sorting based on the tuple (p.a()/p.d(), p.b()/p.d(), p.c()/p.d()) (handle the case d=0 separately, or normalize differently). Then if you don't play with the rounding mode and don't hit any x87 weirdness, it may work.

Actually, operator== for PlaneC3 (the base of Plane_3) looks suspicious to me, I don't see where it handles the fact that the representation is not canonical (multiplying a, b, c and d by 2 keeps the same plane).

--
Marc Glisse



Archive powered by MHonArc 2.6.18.

Top of Page