Subject: CGAL users discussion list
List archive
- From: Martin Baeker <>
- To:
- Subject: Re: [cgal-discuss] Whining again about Modifying a vertex of a Nef_Polyhedron
- Date: Thu, 19 Aug 2010 10:03:08 +0200 (CEST)
- Organization: Institut fuer Werkstoffe TU Braunschweig
YIKES!
That looks really evil, but I'll try it. My application is very
simple, so it may work.
Thanks a huge lot,
Martin.
People who knows about Nef_polyhedron may be in vacation.
In the meantime here is a DIRTY solution without any guarantee
on the correctness of the structure after using it. Please use it with caution (and do not expect any support if using it).
This is compiling on my machine:
Nef_polyhedron nef;
for (Nef_polyhedron::Vertex_const_iterator
it=nef.vertices_begin();it!=nef.vertices_end();++it)
{
const Nef_polyhedron::Vertex* v= &(*it);
Nef_polyhedron::Vertex* v_nc =const_cast<Nef_polyhedron::Vertex*>(v);
v_nc->point()=Point(0,0,0);
}
S.
Martin Baeker wrote:
Dear all,
this is my desperate third attempt to find someone who can help me
iterating over Vertices of a Nef_polyhedron in a non-const way (see below).
Any light whatsoever shed on this will be most gratefully received.
Pretty please??? <making Bambi eyes>
Martin.
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
<>
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
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] Whining again about Modifying a vertex of a Nef_Polyhedron, Martin Baeker, 08/19/2010
- Re: [cgal-discuss] Whining again about Modifying a vertex of a Nef_Polyhedron, Sebastien Loriot (GeometryFactory), 08/19/2010
- Re: [cgal-discuss] Whining again about Modifying a vertex of a Nef_Polyhedron, Martin Baeker, 08/19/2010
- Re: [cgal-discuss] Whining again about Modifying a vertex of a Nef_Polyhedron, Sebastien Loriot (GeometryFactory), 08/19/2010
Archive powered by MHonArc 2.6.16.