Subject: CGAL users discussion list
List archive
- From: "Mengda Wu" <>
- To:
- Subject: Conversion from Surface mesh to Polyhedron error
- Date: Fri, 7 Dec 2007 01:50:34 -0800
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=EefE737QGK8A0ekNjNqHfufsWN8DIqSwhBQd13/lgibZDRrkgDjCpcSwFXBYo+Md72t+QESUxH8thzRWSFX2rZDzM970Be+aHWL1UvehCP1l2vQSvryrJ4LxyN96e1CG1ltpwhKPrAvuzrZJvKYoCVGU6jWvvvG7cU14WH2Z4uw=
Hi CGALers,
I am trying to convert a Surface mesh generated from 3D surface mesh generator to Polyhedron. But there is an error like this:
CGAL::Polyhedron_incremental_builder_3<HDS>::
lookup_halfedge(): input error: facet 127 shares a halfedge from vertex 408 to v
ertex 409 with facet 119.
Does this matter? How to fix? I use a class similar to the class used in Complex_2_in_triangulation_3_file_writer.h.
I found there are some kinds of orientation before put in to polyhedron in this file. But The method seems difficult to understand.
Is this method relevant to my problem?
class PolyhedronBuilder : public CGAL::Modifier_base<HalfedgeDS>
{
const C2t3& c2t3;
const Tr& tr;
public:
PolyhedronBuilder(const C2t3& c2t3) : c2t3(c2t3), tr( c2t3.triangulation()) {};
void operator()( HalfedgeDS& hds)
{
CGAL::Polyhedron_incremental_builder_3<HalfedgeDS> builder(hds, true);
const Tr::size_type number_of_facets = c2t3.number_of_facets ();
//begin surface
builder.begin_surface(tr.number_of_vertices(), number_of_facets);
//vertices
std::map<Vertex_handle, int> V;
int inum = 0;
for(Finite_vertices_iterator vit = tr.finite_vertices_begin(); vit != tr.finite_vertices_end(); ++vit)
{
V[vit] = inum++;
Point p = static_cast<Point>(vit->point());
builder.add_vertex(p);
}
//facets
for( Finite_facets_iterator fit = tr.finite_facets_begin();fit != tr.finite_facets_end(); ++fit)
{
int count = 0;
if ((*fit).first->is_facet_on_surface((*fit).second)==true)
{
int indices[3];
for (int i=0; i<3; i++)
{
indices[i] = V[(*fit).first->vertex(tr.vertex_triple_index(fit->second, i))];
}
if( builder.test_facet(indices+0, indices+3) )
builder.add_facet(indices+0, indices+3);
else
{
builder.begin_facet();
builder.add_vertex_to_facet(indices[2]);
builder.add_vertex_to_facet(indices[1]);
builder.add_vertex_to_facet(indices[0]);
builder.end_facet();
}
count++;
}
//end surface
builder.end_surface();
}
}
};
Thanks,
Mengda
- Conversion from Surface mesh to Polyhedron error, Mengda Wu, 12/07/2007
Archive powered by MHonArc 2.6.16.