Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Some patches for CGAL 4.0

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Some patches for CGAL 4.0


Chronological Thread 
  • From: Philipp Moeller <>
  • To:
  • Cc: Daniel Berlin <>
  • Subject: Re: [cgal-discuss] Some patches for CGAL 4.0
  • Date: Tue, 17 Apr 2012 14:34:54 +0200
  • Organization: GeometryFactory

Sascha Brawer
<>
writes:

> Hello CGAL maintainers,
>
> here's a couple of patches we found useful while playing around with the
> CGAL library.
>

I've applied most of you patches, but have some questions about one of them.

[snipped applied patches]

> **************************************************************************
> Likewise, the following patch seems to fix another memory leak:
>
> --- CGAL-4.0/include/CGAL/Nef_3/SNC_FM_decorator.h 2012-01-13
> 19:25:29.000000000 +0100
> +++ changed-CGAL-4.0/include/CGAL/Nef_3/SNC_FM_decorator.h 2012-04-16
> 11:36:07.549770000 +0200
> @@ -114,16 +114,26 @@
> Halffacet_output(CGAL::Unique_hash_map<I,E>& F, std::vector<E>& S)
> : From(F), Support(S) { edge_number=0; Support[0]=E(); }
>
> +~Halffacet_output() {
> + for (int i = 0; i < vertices.size(); ++i) {
> + geninfo<unsigned>::clear(vertices[i]);
> + }
> +}
> +
> +
> typedef P Point;
> typedef V Vertex_handle;
> typedef unsigned Halfedge_handle;
>
> +mutable vector<void*> vertices;
> +
> CGAL::Unique_hash_map<I,E>& From;
> std::vector<E>& Support;
> unsigned edge_number;
>
> Vertex_handle new_vertex(const Point& p) const
> { geninfo<unsigned>::create(p.vertex()->info());
> + vertices.push_back(p.vertex()->info());
> return p.vertex(); }
>
> Halfedge_handle new_halfedge_pair_at_source(Vertex_handle v)

This would fix the problem, but the whole geninfo part is rather
ugly. We are looking into replacing that part entirely.

[snipped applied patches]

> **************************************************************************
> The following patch is helpful when compiling CGAL with c++11:
>
> --- CGAL-4.0/include/CGAL/Constrained_triangulation_2.h 2012-01-17
> 21:01:00.000000000 +0100
> +++ changed-CGAL-4.0/include/CGAL/Constrained_triangulation_2.h 2012-04-16
> 11:35:58.859492000 +0200
> @@ -541,7 +541,7 @@
>
> list_ab.push_back(Edge(lf, lf->index(current_face)));
> list_ba.push_front(Edge(rf, rf->index(current_face)));
> - intersected_faces.push_front(current_face);
> + intersected_faces.push_front(current_face.handle());
>
> // initcd
> previous_face=current_face;
> @@ -574,7 +574,7 @@
> }
> else {
> lf= current_face->neighbor(i2);
> - intersected_faces.push_front(current_face);
> + intersected_faces.push_front(current_face.handle());
> if (orient == LEFT_TURN)
> list_ab.push_back(Edge(lf, lf->index(current_face)));
> else // orient == RIGHT_TURN
> @@ -590,7 +590,7 @@
>
> // last triangle
> vi = current_vertex;
> - intersected_faces.push_front(current_face);
> + intersected_faces.push_front(current_face.handle());
> lf= current_face->neighbor(cw(ind));
> list_ab.push_back(Edge(lf, lf->index(current_face)));
> rf= current_face->neighbor(ccw(ind));

I don't see how this would be better or different for
C++11. Line_face_circulator has a non-explicit conversion operator to
Face_handle and Face_handle has no converting constructor from
Line_face_circulator, so the operator should be used. Both versions
should call vector::push_back(T&&), neither version would have speed
differences. This would of course change if the conversion operator
would be explicit, which might make sense.

Am I missing something here?

Cheers,
Philipp Moeller
GeometryFactory



Archive powered by MHonArc 2.6.16.

Top of Page