Subject: CGAL users discussion list
List archive
- From: Martin Baeker <>
- To:
- Subject: Re: [cgal-discuss] iteration over facet of volumes nef_polyhedron_3
- Date: Tue, 16 Feb 2010 18:14:06 +0100 (CET)
- Organization: Institut fuer Werkstoffe TU Braunschweig
Hi Andre,
I just faced the same problem today, Here are a few possibilities to
sweep over a Nef_polyhedron. Hope this helps,
Martin.
for(Nef_polyhedron::Halffacet_const_iterator
f = Cube.halffacets_begin (),
end = Cube.halffacets_end();
f != end; ++f)
{
if(f->is_twin()) continue;
std::cout << "Outer iteration, next f \n";
for(Nef_polyhedron::Halffacet_cycle_const_iterator
fc = f->facet_cycles_begin(),
end = f->facet_cycles_end();
fc != end; ++fc)
{
std::cout << "Inner iteration, next fc \n";
if ( fc.is_shalfedge() )
{
std::cout << "Halfedge consists of points \n";
Nef_polyhedron::SHalfedge_const_handle h = fc;
Nef_polyhedron::SHalfedge_around_facet_const_circulator hc(h),
he(hc);
CGAL_For_all(hc,he)
{ // all vertex coordinates in facet cycle
Nef_polyhedron::SVertex_const_handle v = hc->source();
const Nef_polyhedron::Point_3& point = v->source()->point();
std::cout << "p: " << CGAL::to_double(point.x()) << " " <<
CGAL::to_double(point.y()) << " " <<
CGAL::to_double(point.z()) << std::endl;
}
}
}
}
// Alternative to iterating over halfedges:
// Nef_polyhedron::Halfedge_const_iterator e = Cube.halfedges_begin();
// CGAL_forall_halfedges(e,Cube) {
for(Nef_polyhedron::Halfedge_const_iterator
e = Cube.halfedges_begin(),
end = Cube.halfedges_end();
e != end; ++e)
{
const Nef_polyhedron::Vertex_const_handle& s = e->source();
const Nef_polyhedron::Vertex_const_handle& t = e->twin()->source();
const Nef_polyhedron::Point_3& a = s->point();
const Nef_polyhedron::Point_3& b = t->point();
std::cout << "From a: " << CGAL::to_double(a.x()) << " " <<
CGAL::to_double(a.y()) << " " <<
CGAL::to_double(a.z()) << " to b: " <<
CGAL::to_double(b.x()) << " " <<
CGAL::to_double(b.y()) << " " <<
CGAL::to_double(b.z()) <<std::endl;
typedef Nef_polyhedron::Object_handle Object_handle;
typedef Nef_polyhedron::Vertex_const_handle Vertex_const_handle;
Vertex_const_handle v;
Object_handle o = Cube.locate(a);
if(CGAL::assign(v,o))
std::cout << " a is a vertex" << std::endl;
else
std::cout << " a is not a vertex" << std::endl;
}
// Nef_polyhedron::Vertex_const_iterator v;
// CGAL_forall_vertices(v, Cube.sncp())
for(Nef_polyhedron::Vertex_const_iterator
v = Cube.vertices_begin(),
end = Cube.vertices_end();
v != end; ++v)
{
const Nef_polyhedron::Point_3& a = v->point();
std::cout << "Vertex: " << CGAL::to_double(a.x()) << " " <<
CGAL::to_double(a.y()) << " " <<
CGAL::to_double(a.z()) << std::endl;
}
> Hi!
>
> I am looking for an way to iterate over all facets, which belong to a
> bounded
> volume of a Nef_polyhedron_3. ATM I am kind of overwhelmed by the
> documentation, so I am guess it's possible, but I don't see an easy way to
> accomplish this. Maybe there is somebody who give me quick hint which kind
> of
> iterator (combination?) I could employ??
>
> Kind regards,
> Andre Massing
>
> --
> 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] iteration over facet of volumes nef_polyhedron_3, Andre Massing, 02/16/2010
- Re: [cgal-discuss] iteration over facet of volumes nef_polyhedron_3, Atul Thakur, 02/16/2010
- Re: [cgal-discuss] iteration over facet of volumes nef_polyhedron_3, Martin Baeker, 02/16/2010
- Re: [cgal-discuss] iteration over facet of volumes nef_polyhedron_3, Andre Massing, 02/16/2010
- Re: [cgal-discuss] iteration over facet of volumes nef_polyhedron_3, Andre Massing, 02/16/2010
Archive powered by MHonArc 2.6.16.