[OpenSCAD] can anyone help with cgal and c++ stl iterators?

Clifford Wolf clifford at clifford.at
Mon Jan 4 03:55:49 CET 2010


On Sun, Jan 03, 2010 at 04:48:22PM +0100, Marius Kintel wrote:
> > I thought I could call this constructor like that  
> > (CGAL_Nef_polyhedron2 is
> > a typedef to Nef_polyhedron_2<CGAL::Extended_cartesian<CGAL::Gmpq>>):
> >
> >  std::vector< std::vector<CGAL_Nef_polyhedron2::Point> > pdata;
> >  N.p2 = CGAL_Nef_polyhedron2(pdata.begin, pdata.end,  
> > CGAL_Nef_polyhedron2::POLYGONS);
> The obvious problem is that begin and end are methods which should be  
> called, but that is perhaps just a typo?
> A stand-alone (or OpenSCAD patch), almost compilable, example would  
> help getting into it.

ok - I'm a big step further now: still not performing the transformation
but creating one Nef_polyhedron_2 from another one:

   typedef std::list<CGAL_Nef_polyhedron2::Point> point_list_t;
   typedef point_list_t::iterator point_list_it;
   std::list< point_list_t > pdata_point_lists;
   std::list < std::pair < point_list_it, point_list_it > >pdata;

   typedef CGAL_Nef_polyhedron2::Explorer Explorer;
   typedef Explorer::Face_const_iterator fci_t;
   typedef Explorer::Halfedge_around_face_const_circulator heafcc_t;
   Explorer E = N.p2.explorer();

   for (fci_t fit = E.faces_begin(), fend = E.faces_end(); fit != fend; ++fit)
      heafcc_t fcirc(E.halfedge(fit)), fend(fcirc);
      CGAL_For_all(fcirc, fend) {
         if (E.is_standard(E.target(fcirc))) {
            Explorer::Point ep = E.point(E.target(fcirc));
            // FIXME: Actually do the transformation
      pdata.push_back(std::make_pair(pdata_point_lists.back().begin(), pdata_point_lists.back().end()));

   N.p2 = CGAL_Nef_polyhedron2(pdata.begin(), pdata.end(), CGAL_Nef_polyhedron2::POLYGONS);

Next miracle: how to apply an Aff_transformation_2 to an Explorer::Point

 - clifford

M$ is not the answer. M$ is the question. No is the answer!

More information about the Openscad mailing list