Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Deleting halfedges from a polyhedron

Subject: CGAL users discussion list

List archive

[cgal-discuss] Deleting halfedges from a polyhedron


Chronological Thread 
  • From: "Jens K. Becker" <>
  • To:
  • Subject: [cgal-discuss] Deleting halfedges from a polyhedron
  • Date: Thu, 20 Nov 2008 13:35:38 +0100

Hi all,

I am trying to delete halfedges (an edge) from a polyhedron. I have two facets
that share an edge and if the two facets are coplanar, the edge should be
deleted and the facets merged. P.join_facets produces antennas (no idea why) so
I am trying to do it by hand using the underlying HDS (using the delegate
function to get access to the hds). It almost works, but not quite. And I am
not sure why not. Printing out the size of the hds-halfedges and facets shows
that the correct things have been deleted, but trying to write out the
resulting polyhedron as an off-file results in an error message (one facet has
less than 3 points). Any ideas?

Thanks,

Jens

hh and tmp are the same halfedge which should be erased

...
f1=hh->face();
//get face handle to face we erase
f2=hh->opposite()->face();
...
h1=tmp->prev();
h2=h1->next()->opposite()->next();
h1=h1->prev();
t2=h1->next()->opposite()->prev();
//set new next
h1->set_next(h2);
//set new prev
h2->set_prev(h1);
//other side
//set new prev
t1->set_prev(t2);
//set new next
t2->set_next(t1);
//set new face and vertex handles
while(t1!=t2)
{
t1->set_face(f1);
t1->vertex()->set_halfedge(t1);
t1=t1->next();
}
t2->set_face(f1);
f1->set_halfedge(t1);
//erase things
hds.edges_erase(tmp);
hds.faces_erase(f2);

--
Dr. J.K. Becker
University of Tuebingen - Institute for Geoscience
Sigwartst. 10 - 72076 Tuebingen (Germany)
Tel.: ++49 7071 29 73139 Fax: +49 7071 5059
web: http://www.jkbecker.de






Archive powered by MHonArc 2.6.16.

Top of Page