Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Using Plane_3 as key in a std::map

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Using Plane_3 as key in a std::map


Chronological Thread 
  • From: Marc Glisse <>
  • To:
  • Subject: Re: [cgal-discuss] Using Plane_3 as key in a std::map
  • Date: Tue, 8 Dec 2015 17:22:13 +0100 (CET)

On Tue, 8 Dec 2015, gunshi gupta wrote:

Okay, apologies, i guess the confusion regarding field and ring type was
due to some misinterpretation while reading the kernel manual.
sample code:

Please don't post "sample code" but something that we can directly copy-paste in a file and compile. Also post the errors you are getting. If I try to complete your program, it seems to work, so it is quite possible that your problem is precisely with the #includes, i.e. something you did not show...


typedef CGAL::Lazy_exact_nt<CGAL::Gmpq>
NT;

typedef CGAL::Simple_cartesian<NT>
K;//tried with Extended cartesian as well

typedef K::Point_3
Point3;

typedef K::Plane_3
Plane3;

std::map<Plane3, int,CGAL::Plane_lt> planes;

planes[Plane3(Point3(12,0,0),Point3(0,6,0),Point3(0,0,8))]=2;

std::cout<<planes[Plane3(Point3(6,3,0),Point3(0,3,4),Point3(6,0,4))];


//output: 0

//Plane3(Point3(6,3,0),Point3(0,3,4),Point3(6,0,4))==Plane3(Point3(12,0,0),
Point3(0,6,0),Point3(0,0,8)) returns true

On Tue, Dec 8, 2015 at 9:06 PM, Marc Glisse
<>
wrote:

On Tue, 8 Dec 2015, vimarsh wrote:

I wanted to use a Plane_3 as the key value in a std::map, so i passed the
third argument to the map as:

typedef CGAL::Lazy_exact_nt<CGAL::Gmpq> NT;
typedef CGAL::Extended_cartesian<NT> K;
typedef K::Plane_3
Plane3;

It does not work if i just do std::map<Plane3,int>,(so i guess it is not
derived from LessComparable), and i tried passing CGAL::Plane_lt as the
third argument, but later realised that is only for RingType while my
kernel
uses a FieldType.


Uh? A field is a ring. Could you show a minimal program and the error you
got?

How can i achieve what i want with my kernel?
(I also tried replacing the RT with FT, after copying how Plane_lt is
defined, in my code, but that didn't work either )


"doesn't work" doesn't help.

--
Marc Glisse

--
Marc Glisse



Archive powered by MHonArc 2.6.18.

Top of Page