Subject: CGAL users discussion list
List archive
- From: "Shi Yan" <>
- To:
- Subject: [cgal-discuss] how to remove vertices?
- Date: Tue, 19 Aug 2008 06:37:25 +0800
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=K/2i2Pl8s/3x7g79M1TS0z2o4FCxliMiXTXHGYyJf4dnVU/KwKdD4eagYqSxH2CeyV kXxQyv81L83SOtYEDdrRaE/yV5iamjqvpQkQeocRbdMMtLQd3YAOTy98pkc/tR93Sf7v rB3wd+Hooa9+o2YZ+QRhIwcdB9tCmKaibobYg=
hello guys,
i have some trouble with removing vertices from the half-edge data structure.
i have a geometry object, and i let it deform, however, when some
parts of the object move out of the scope, i will remove that part.
but i cannot find vertex remove function in CGAL.
i'm trying to use P.erase_center_vertex() combining with
P.erase_facet(), but it doesn't work, because i always got access
violation, null halfedge handle errors.
here is what i did:
i first travel through all the vertices, and decide if some need to be
removed, and push them into a std::vector:
Vertex_iterator vIter=p.vertices_begin ();
Vertex_iterator vIterEnd=p.vertices_end ();
std::vector< Vertex_iterator> toBeRemoved;
for(;vIter!=vIterEnd;++vIter)
{
if needs to be removed:
toBeRemoved.push_back(vIter);
}
and then, i visit each entry of the std::vector and remove it from the
half-edge data
if(toBeRemoved.size()>0)
{
std::vector< Vertex_iterator>::iterator rIter=toBeRemoved.begin();
for(;rIter!=toBeRemoved.end();++rIter)
{
p.erase_facet ( p.erase_center_vertex
((*rIter)->halfedge()) );
}
}
i guess, the problem is, when some vertex is removed, some half-edge
handle becomes invalid. but i don't know how to do this in a better
way.
i think this is a very common problem, isn't it?
thank you so much.
- [cgal-discuss] how to remove vertices?, Shi Yan, 08/19/2008
Archive powered by MHonArc 2.6.16.