Skip to Content.
Sympa Menu

cgal-discuss - Re:[cgal-discuss] how to get triangles incident to edge

Subject: CGAL users discussion list

List archive

Re:[cgal-discuss] how to get triangles incident to edge


Chronological Thread 
  • From: "Thomas Zangl - Home" <>
  • To: "cgal-discuss" <>
  • Subject: Re:[cgal-discuss] how to get triangles incident to edge
  • Date: Thu, 16 Aug 2007 00:19:32 +0200


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();

// 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,
--
----------------------------------------------------------------
,yours Thomas Zangl, Bakk.rer.soc.oec. -

-
- Freelancer - IT Consulting & Software Development -
- Student of Software Development-Economy (Master) -



Archive powered by MHonArc 2.6.16.

Top of Page