Subject: CGAL users discussion list
List archive
- From: Martin Baeker <>
- To: CGAL Mailinglist <>
- Subject: [cgal-discuss] Modifying a vertex of a Nef_Polyhedron - second try
- Date: Wed, 18 Aug 2010 10:25:01 +0200 (CEST)
- Organization: Institut fuer Werkstoffe TU Braunschweig
Dear all,
yesterday I asked about modifying a vertex of a Nef_polyhedron.
By now I understand the following:
Obviously, I should use a
Nef_polyhedron::Vertex_iterator
insetad of a Nef_polyhedron::Vertex_const_iterator.
The only problem I have is that this does not work because
the function vertices_begin()
seems to be const, so I cannot iterate my iterator.
According to the manual, there should be a non-const version of this,
but I'm at a loss how to call it. I found that vertices_begin() is
defined in SNC_decorator.h and SNC_const_decorator.h, but *both* are
included in Nef_polyhedron_3.h Nef_polyhedron_3.h contains the follwoing declaration
template <typename Kernel_, typename Items_ = typename
CGAL::Default_items<Kernel_>::Items, typename Mark_ = bool>
class Nef_polyhedron_3 : public CGAL::Handle_for< Nef_polyhedron_3_rep<Kernel_,
Items_, Mark_> >,
public
SNC_const_decorator<SNC_structure<Kernel_,Items_,Mark_> >
Is it this that is responsible for the choice? if so, how do I access
the non-const version of vertices_begin? Do I need to modify
Nef_polyhedron_3.h itself? That seems a "bit" dangerous to me...
Any help would really be appreciated, since I'm completely lost...
Martin.
Priv.-Doz. Dr. Martin Bäker
Institut für Werkstoffe
Technische Universität Braunschweig
Langer Kamp 8
38106 Braunschweig
Germany
Tel.: 00-49-531-391-3073
Fax 00-49-531-391-3058
<>
---------- Forwarded message ----------
Date: Tue, 17 Aug 2010 10:18:53 +0200 (CEST)
From: Martin Baeker
<>
To: CGAL Mailinglist
<>
Subject: Modifying a vertex of a Nef_Polyhedron
Dear all,
I'm trying to loop over the vertices of a Nef_Polyhedron and modify
the coordinates of one of the vertices:
for(Nef_polyhedron::Vertex_const_iterator
v = Cube.vertices_begin(),
end = Cube.vertices_end();
v != end; ++v)
{
if ( v->point() ==tip)
v->point() = Nef_polyhedron::Point_3(0,0,0);//tip.x(), tip.y(), secondHeight);
break;
}
The trouble is that v seems to be const and cannot be modified, at
least that's how I understand the compiler error:
error: passing ‘const CGAL::Point_3<CGAL::Cartesian<CGAL::Gmpq> >’ as ‘this’ argument of ‘CGAL::Point_3<CGAL::Cartesian<CGAL::Gmpq> >& CGAL::Point_3<CGAL::Cartesian<CGAL::Gmpq> >::operator=(const CGAL::Point_3<CGAL::Cartesian<CGAL::Gmpq> >&)’ discards qualifiers
There seems to be no such thing as a non-constant Vertex-iterator - so
how can I loop over vertices in a way that I can modify their coordinates?
Any help greatly appreciated, as usual,
Martin.
PS: Here's my bunch of Definitions, just in case:
typedef CGAL::Cartesian<CGAL::Gmpq> Kernel;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron;
typedef Kernel::Plane_3 Plane_3;
typedef Kernel::Ray_3 Ray_3;
typedef Kernel::Point_3 Point;
typedef Kernel::Segment_3 Segment;
typedef Kernel::Line_3 Line;
typedef Kernel::Vector_3 Vector_3;
typedef EKernel::Plane_3 EPlane_3;
typedef EKernel::Point_3 EPoint;
typedef EKernel::Vector_3 EVector_3;
typedef Polyhedron::Halfedge_handle Halfedge_handle;
typedef Polyhedron::Halfedge_around_facet_circulator
Halfedge_facet_circulator;
typedef Polyhedron::Halfedge_iterator Halfedge_iterator;
typedef Polyhedron::Facet_handle Facet_handle;
typedef Polyhedron::Facet Facet;
typedef Polyhedron::Facet_iterator Facet_iterator;
typedef Kernel::Aff_transformation_3 Aff_transformation_3;
typedef Nef_polyhedron::Vertex_const_handle Vertex_const_handle;
typedef Nef_polyhedron::Halfedge_const_handle Halfedge_const_handle;
typedef Nef_polyhedron::Halffacet_const_handle Halffacet_const_handle;
typedef Nef_polyhedron::Volume_const_handle Volume_const_handle;
typedef Nef_polyhedron::Object_handle Object_handle;
Priv.-Doz. Dr. Martin Bäker
Institut für Werkstoffe
Technische Universität Braunschweig
Langer Kamp 8
38106 Braunschweig
Germany
Tel.: 00-49-531-391-3073
Fax 00-49-531-391-3058
<>
- [cgal-discuss] Modifying a vertex of a Nef_Polyhedron - second try, Martin Baeker, 08/18/2010
Archive powered by MHonArc 2.6.16.