Hi i'm using a Delaunay_triangulation_2 and Delaunay_triangulation_3 for finding points for interpolation. I found how to use locate for Delaunay_triangulation_2:
Locate_type loc;
int li;
CgalPoint point(_params[0], _params[1]);
Face_handle handle = delaunay.locate(point, loc, li);
if(loc == Delaunay::VERTEX)
{
MyData data = _handle->vertex(_li)->info();
}
else if(loc == Delaunay::EDGE)
{
MyData data1 = handle->vertex(handle->cw(li))->info();
MyData data2 = handle->vertex(handle->ccw(li))->info();
}
else if(loc == Delaunay::FACE)
{
MyData data1 = handle->vertex(0)->info();
MyData data2 = handle->vertex(1)->info();
MyData data3 = handle->vertex(2)->info();
}
Those tricks with cw and ccw are not intuitive for me.
And when using Triangulation_3 I have a problem with implementing EDGE, FACET and VEREX cases
Locate_type loc;
int li,lj;
Cell_handle handle = delaunay.locate(point, loc, li, lj);
switch(loc)
{
case Delaunay::CELL:
{
for(int i = 0; i < 4 ; ++i)
MyData data = handle->vertex(i)->info();
break;
}
case Delaunay::EDGE:
case Delaunay::FACET:
case Delaunay::VERTEX:
assert(false);
}
My test shows that case Delaunay::VERTEX behaves the same as in Triangulation_2.
Triangulation_3 gives different handle type then Triangulation_2. Do I have to use some cw and ccw tricks here?
Docs:
If query lies on a facet, an edge or on a vertex, one of the cells having query on its boundary is returned. http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Triangulation_3_ref/Class_Triangulation_3.html
I want to get two points of edge that have my query and three points of face (in case when something else is returned then Delaunay::CELL). How to get it from "one of the cells having query on its boundary"?
The documentation of what is a facet and an edge are inside the combinatorial part of the triangulation.
if(loc == Delaunay::VERTEX)
{
MyData data = handle->vertex(li)->info();
}
else if(loc == Delaunay::EDGE)
{
MyData data1 = handle->vertex(handle->vertex(li))->info();
MyData data2 = handle->vertex(handle->vertex(lj))->info();
}
else if(loc == Delaunay::FACET)
{
MyData data1 = handle->vertex( (li+1)%4 )->info();
MyData data2 = handle->vertex( (li+2)%4 )->info();
MyData data3 = handle->vertex( (li+3)%4 )->info();
}