Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CGAL: Output from neighbour when the triangle has none

So I am wondering what happens in CGAL Delaunay triangulation when you call the neighbor function for a neighbor that doesn't exist. In the documentation (HERE) it says this:

The neighbor with index i is the neighbor which is opposite to the vertex with index i.

Face_handle  f.neighbor ( int i) const   //returns the neighbor i of f.
                                        //Precondition:     0 ≤ i ≤ 2.

But not all triangles can have 3 neighbors. Edge and corner triangles will neighbor only 2. Given that it must now return a Face_handle, what would happen for the neighbors that don't exist? Maybe it will be NULL? How can i check this?

The reason i am looking to do this is because i would like to identify all the edge triangles in a Delaunay triangulation. Being able to check for triangles with 2 or less neighbors would be very useful.

Any ideas?

like image 225
Fantastic Mr Fox Avatar asked Nov 26 '25 05:11

Fantastic Mr Fox


1 Answers

See the documentation.

CGAL introduces an infinite vertex, hence each "border edge" has an additional neighbour, which is an infinite triangle composed of the two vertices of your edge and the infinite vertex.

like image 66
Boris Dalstein Avatar answered Nov 27 '25 18:11

Boris Dalstein



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!