Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Polyhedron_3: problem converting from pointer to handle

Subject: CGAL users discussion list

List archive

[cgal-discuss] Polyhedron_3: problem converting from pointer to handle


Chronological Thread 
  • From: <>
  • To:
  • Subject: [cgal-discuss] Polyhedron_3: problem converting from pointer to handle
  • Date: Wed, 7 Oct 2009 18:44:14 +0200 (CEST)

Hi all,

I'm using Polyhedron_3 with my own item types and would like to create some
member functions for my items, but I'm not able to convert from "this" pointer
to corresponding handle. I know there are the static member functions
(vertex_handle(), halfedge_handle(), face_handle()) in HalfedgeDS, but I just
don't manage to use them correctly and the compiler (g++ 4.2.4) complains
about
ambiguous overloading (I'm not that experienced with these C++ templates).

Below is a dummy example, which shows what I'm trying to do. It's just
slightly
modified from <cgalroot>/examples/Polyhedron/polyhedron_prog_color.cpp but
shows the problem.

Any help will be highly appreciated.
Thanks,
Juha



//##########################################################
// Dummy example modified from file
// <cgalroot>/examples/Polyhedron/polyhedron_prog_color.cpp
//##########################################################
#include <CGAL/Simple_cartesian.h>
#include <CGAL/IO/Color.h>
#include <CGAL/Polyhedron_3.h>

// A face type with a color member variable.
template <class Refs>
struct My_face : public CGAL::HalfedgeDS_face_base<Refs> {
CGAL::Color color;

// Modified part begins. ##################################
typedef Refs HDS;
typedef typename Refs::Face_handle Face_handle;
void dummy_test() {
Face_handle h = HDS::face_handle(this); // Here's the problem.
}
// Modified part ends. ####################################
};

// An items type using my face.
struct My_items : public CGAL::Polyhedron_items_3 {
template <class Refs, class Traits>
struct Face_wrapper {
typedef My_face<Refs> Face;
};
};

typedef CGAL::Simple_cartesian<double> Kernel;
typedef CGAL::Polyhedron_3<Kernel, My_items> Polyhedron;
typedef Polyhedron::Halfedge_handle Halfedge_handle;

int main() {
Polyhedron P;
Halfedge_handle h = P.make_tetrahedron();
h->facet()->color = CGAL::RED;
// Modified part begins. ##################################
h->facet()->dummy_test();
// Modified part ends. ####################################
return 0;
}


  • [cgal-discuss] Polyhedron_3: problem converting from pointer to handle, juha.makipelto, 10/07/2009

Archive powered by MHonArc 2.6.16.

Top of Page