Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Troubles in converting triangulation to polyhedron
- Date: Mon, 25 Mar 2013 06:57:41 +0100
- Organization: GeometryFactory
On 03/22/2013 04:39 AM, wenchao wrote:
Dear CGAL developers,
I encountered a problem when using incremental builder to build a
polyhedron. I used the add_vertex() and add_vertex_to_facet() to construct a
polyhedron from a triangulation. It looks something like:
//////////////////////////////////////////////////////////////////////////////////
builder.begin_surface(points.size(), points.size()/3,
CGAL::Polyhedron_incremental_builder_3<HDS>::ABSOLUTE_INDEXING);
for (unsigned int i = 0; i< points.size(); i++)
{
Vertex_handle vh = builder.add_vertex(points[i].p);
vh->group_id = points[i].group_id;
vh->mp = points[i].prj_pnt;
}
some_function();
builder.end_surface();
//////////////////////////////////////////////////////////////////////////////
void some_function(unsigned int i, unsigned int j, unsigned int k)
{
// some orientation code check here.
b.begin_facet();
b.add_vertex_to_facet(k);
b.add_vertex_to_facet(j);
b.add_vertex_to_facet(i);
b.end_facet();
}
A mistake could be that the orientation of the facets are not consistent.
Looking here:
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Triangulation_3/Chapter_main.html#Section_39.1
you can see how the orientation should be.
if i is the index opposite to the face you want to display,
the following code should orient the facets of the polyhedron
counterclockwise when seen from outside.
int indices[3]={(i+1)%4,(i+2)%4,(i+3)%4};
if (i%2==0) swap(indices[1],indices[2]);
b.begin_facet();
b.add_vertex_to_facet(indices[0]);
b.add_vertex_to_facet(indices[1]);
b.add_vertex_to_facet(indices[2]);
b.end_facet();
///////////////////////////////////////////////////////////////////////////////What check are you talking about?
However, after I built this polyhedron P, the validity check
P.is_valid(false, 1) always fails.
More surprisingly, I run the example in
examples/Polyhedron/polyhedron_prog_incr_builder.cpp. I added the same check
in this example. But it still failed.
Sebastien.
Can anyone help me find the reason for this trouble?
Thanks a lot!
Best,
Wenchao
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Troubles-in-converting-triangulation-to-polyhedron-tp4657006.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] Troubles in converting triangulation to polyhedron, wenchao, 03/22/2013
- Re: [cgal-discuss] Troubles in converting triangulation to polyhedron, Sebastien Loriot (GeometryFactory), 03/25/2013
Archive powered by MHonArc 2.6.18.