Subject: CGAL users discussion list
List archive
- From: tang <>
- To:
- Subject: [cgal-discuss] Ask for help: remove degenerate facet
- Date: Mon, 24 Jun 2013 18:37:51 -0700 (PDT)
Dear all,
I need to remove the degenerate facet from the surface facets. The function
is as follows, however, it crashed after several steps, could anyone help me
to take a look at it and point out the problem?
Thanks,
Zhanghong Tang
void RemoveDegenerateFacet(myobj *object,double dismin)
{
/// this function is used to remove degenerate triangles
/// i.e. one of it's edge is smaller than dismin
/// Zhanghong Tang @ 06/25/2012
int found;
double d;
Polyhedron *obj=(Polyhedron *)object->obj;
/// check for small area triangle
Point_3 p1, p2, p3;
Halfedge_handle h1, h2, h3;
while(1)
{
found=0;
for ( Facet_iterator i = obj->facets_begin() ; i !=
obj->facets_end();
++i)
{
/// get 3 points of this facet(triangle)
h1 = i->halfedge();
h2 = h1->next();
h3 = h2->next();
/// (p3->p1): h1
/// (p1->p2): h->next()
/// (p2->p3): h->next()->next()
p1 = h1->vertex()->point();
p2 = h2->vertex()->point();
p3 = h3->vertex()->point();
d=CGAL::to_double(CGAL::squared_distance(p1,p2));
if(d<dismin)
{
obj->join_vertex(h2);
found=1;
break;
}
d=CGAL::to_double(CGAL::squared_distance(p2,p3));
if(d<dismin)
{
obj->join_vertex(h3);
found=1;
break;
}
d=CGAL::to_double(CGAL::squared_distance(p3,p1));
if(d<dismin)
{
obj->join_vertex(h1);
found=1;
break;
}
}
if(found==0)break;
}
}
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Ask-for-help-remove-degenerate-facet-tp4657703.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] Ask for help: remove degenerate facet, tang, 06/25/2013
Archive powered by MHonArc 2.6.18.