Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Bug of 'join_vertex' in CGAL?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Bug of 'join_vertex' in CGAL?


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Bug of 'join_vertex' in CGAL?
  • Date: Wed, 15 Jan 2014 05:51:45 +0100
  • Organization: GeometryFactory

Reading the documentation:

http://doc.cgal.org/latest/Polyhedron/classCGAL_1_1Polyhedron__3.html#a8edb13d0fb5748b20a8173bec85e7243

"Precondition:
The size of both facets incident to h is at least four"

Since you are working on a triangulated surface, it does not work.

You should have a look at the edge simplification package:
http://doc.cgal.org/latest/Surface_mesh_simplification/index.html#Chapter_Triangulated_Surface_Mesh_Simplification

or directly use the internal function (which has no topology nor geometric tests):

#include <CGAL/Surface_mesh_simplification/halfedge_collapse_Polyhedron_3.h>
#include <CGAL/boost/graph/halfedge_graph_traits_Polyhedron_3.h>

CGAL::Surface_mesh_simplification::halfedge_collapse(hedge,poly);

Sebastien.

On 01/15/2014 03:38 AM, tang wrote:
Dear all,

I installed latest CGAL 4.3 and run the following code:

void SimplifySurfaceMeshCGAL(Polyhedron *obj,double edgelengthmin)
{
double minimum_edge_length = edgelengthmin*edgelengthmin; // squared
double len;
{std::ofstream log("update.off");log << *obj; } update.off
<http://cgal-discuss.949826.n4.nabble.com/file/n4658645/update.off>
int count=0,n20=0;
while(1)
{
int found=0;
Halfedge_iterator eb0=obj->halfedges_begin() ;
for( Polyhedron::Halfedge_iterator eb =
obj->halfedges_begin() ; eb !=
obj->halfedges_end() ; ++ eb )
{
len=get_edge_length<Polyhedron>(eb);
if(len<minimum_edge_length)
{
*obj->join_vertex(eb);
eb=eb0 ;
if(found==0)found=1;
count++;
int n2=0;
for ( Facet_iterator i = obj->facets_begin(); i != obj->facets_end(); ++i)
{
Halfedge_facet_circulator j = i->facet_begin();
if((int)CGAL::circulator_size(j)==2)n2++;
}
if(n2>n20)
{
printf("%d %d\n",count,n2);
n20=n2;
{std::ofstream log("update1.off");log << *obj; } update1.off
<http://cgal-discuss.949826.n4.nabble.com/file/n4658645/update1.off>
exit(0);
}
}
else
eb0=eb;
}
if(found==0)break;
}
}


I found that every time running the function "join_vertex", two degenerated
facets (facets contains only two vertices) generated. Is it a bug of the
function "join_vertex"? If not, how can I remove the degenerated facets?

Thanks



--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Bug-of-join-vertex-in-CGAL-tp4658645.html
Sent from the cgal-discuss mailing list archive at Nabble.com.





Archive powered by MHonArc 2.6.18.

Top of Page