Subject: CGAL users discussion list
List archive
- From: Andreas Fabri <>
- To:
- Subject: Re: [cgal-discuss] how to get triangles incident to edge
- Date: Thu, 16 Aug 2007 15:13:42 +0200
Thomas Zangl - Home wrote:
Am Wed, 15 Aug 2007 14:25:50 -0400, schrieb "Satyajit Sarangi" <>:
Hi!
1) How do i extract an edge from a triangle i have in 3D delaunay. (Not from
the cell ) since i extract a triangle from each cell. So how do i extract
each edge from the triangle.
You mean, you have a facet iterator and you process each facet of the
triangulation?
You can easily get the edges of the given facet:
// fSl = facet iterator Cell_handle cell = fSl->first;
// this is the index of the facet's opposite vertex
int vertexIdx = fSl->second;
// get the three points forming a facet
Point p1=cell->vertex((vertexIdx+1) % 4)->point();
Point p2=cell->vertex((vertexIdx+2) % 4)->point();
Point p3=cell->vertex((vertexIdx+3) % 4)->point();
Note that there is also a static helper function in all
3D triangulations, coming from the base class Triangulation_utils_3
static int vertex_triple_index(const int i, const int j)
{
// indexes of the jth vertex of the facet of a cell
// opposite to vertx i
What is nice about it, is that the indices are then
in counterclockwise order, which you cannot guarantee
with the mod 4
andreas
// construct the edges
Segment sideA(p1,p2);
Segment sideB(p2,p3);
Segment sideC(p3,p1);
Now you have the edges defined by the respective vertices.2) How do i get all the other triangles incident to this edge.
You can use t.incident_facets ( Cell_handle c, int i, int j).
Given the possibility above, you have an cell handle (Variable "cell")
and you have the vertexIdx (integer). The vertexIdx is the vertex
opposite of the facet in the cell. E.g. you have a cell formed by four
vertices ABCD and you look at the facet formed by ABC then is D the
opposite vertice of the facet ABC.
In fact you need the vertexIdx to define to parameters i and j. e.g. if you want sideA of the example above, you will write:
Facet_circulator circ = t.incident_facets(cell, vertexIdx+1, vertexIdx+2
);
for sideB you will write:
Facet_circulator circ = t.incident_facets(cell, vertexIdx+2, vertexIdx+3
);
and so on. Please keep in mind that I defined sideA as the side
connecting the vertices A-B, etc. This might be different from you
understanding. I hope you got the conecept :-)
Best regards,
- how to get triangles incident to edge, Satyajit Sarangi, 08/15/2007
- Re:[cgal-discuss] how to get triangles incident to edge, Thomas Zangl - Home, 08/16/2007
- Re: [cgal-discuss] how to get triangles incident to edge, Andreas Fabri, 08/16/2007
- Re:[cgal-discuss] how to get triangles incident to edge, Thomas Zangl - Home, 08/16/2007
Archive powered by MHonArc 2.6.16.