Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Iterating over facets and Points of a Convex_hull_d
- Date: Thu, 26 Apr 2012 16:46:11 +0200
On 04/26/2012 10:05 AM, luchia wrote:
Hallo,you can extract 3 points for the facet and compute the normal vector
I'm a new CGAL user and I'm facing a problem that actually I do not know how
to solve.
I'm writing the procedure Lower_hull that takes in input a Convex_hull_d
CH_d, an empty
vector vfacet of type std::vector<Facet> with Facet of type
Convex_hull_d::Facet_handle
and returns in vfacet the vector of all the facet of CH_d that belong to the
lower hull.
Here is the code:
*void Lower_hull(Convex_hull_d& CH_d, VFacet vfacet) {
Hyperplane hp;
Vector_d normal;
for (Facet_iterator i = CH_d.facets_begin(); i != CH_d.facets_end();
++i) {
hp = CH_d.hyperplane_supporting(i); // Hyperplane of the i-th
facet
normal = hp.orthogonal_vector(); // Normal to hp
if(normal[(normal.dimension())-1]<0)
{
vfacet.push_back(i);
for (Convex_hull_d::Point_const_iterator j =
i->points_begin(); j!=
i->points_end(); ++j){}
}
}
}*
Questions:
1. The idea to use the Hyperplane passing throuth a facet to extract its
orthogonal vector
does it make sense?
directly, but using the hyperplane is fine too (you have an extra construction).
Iterators value_type are Facet, not Facet_handle.
2. Why the statement CH_d.hyperplane_supporting(i) is it correct? The method
hyperplane_supporting takes in input a facet_handle, while "i" its an
iterator over facet. Thus ... shouldn't we pass (*i) insteat of i?
There is a convertion from iterator to Facet_handle.
Look at here:
3. The cicle:
for (Convex_hull_d::Point_const_iterator j = i->points_begin(); j!=
i->points_end(); ++j){}
was designed in order to iterate over the points of a given facet i. But it
does not work ... I obtained
a type error message.
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Convex_hull_d_ref/Class_Convex_hull_d.html
Vertex_handle C.vertex_of_facet ( Facet_handle f, int i)
returns the vertex corresponding to the i-th vertex of f.
for (int k=0;k<dim-1; ++k)
CH_d.vertex_of_facet(i,k)->point();
Sebastien.
Thaks your patience and for your help,
Luca
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Iterating-over-facets-and-Points-of-a-Convex-hull-d-tp4589157p4589157.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] Iterating over facets and Points of a Convex_hull_d, luchia, 04/26/2012
- Re: [cgal-discuss] Iterating over facets and Points of a Convex_hull_d, Sebastien Loriot (GeometryFactory), 04/26/2012
- [cgal-discuss] Re: Iterating over facets and Points of a Convex_hull_d, luchia, 04/26/2012
- Re: [cgal-discuss] Re: Iterating over facets and Points of a Convex_hull_d, Sebastien Loriot (GeometryFactory), 04/27/2012
- [cgal-discuss] Re: Iterating over facets and Points of a Convex_hull_d, luchia, 04/27/2012
- Re: [cgal-discuss] Re: Iterating over facets and Points of a Convex_hull_d, Sebastien Loriot (GeometryFactory), 04/27/2012
Archive powered by MHonArc 2.6.16.