0

So I am very confused about the find_conflicts function in CGAL. I thought I knew std::pair, and I thought I knew what was going on in find_conflicts(), but for the life of me, I am not sure how to access the results. I thought that the iterator that is passed to find_conflicts would be enough to then access the values directly. (i.e., I want to get at those facets that I put in the "vector facets,") and it appears as if I'm doing that because I can successfully

           typedef std::pair<std::vector<Facet>, std::vector<Cell> > FacetAndCell;


            *  *  *


            Cell_handle cell = T.locate(curr_point);
            std::vector<Facet> facets;

            T.find_conflicts(curr_point, cell, std::back_inserter(facets), CGAL::Emptyset_iterator());

            CGAL::First_of_pair_property_map<FacetAndCell> my_p_map();

            Delaunay::Finite_facets_iterator ff_iter;
            std::vector<Facet>::iterator facet_iter;

            // Here, what I'm trying to achieve is figuring out which of the facets 
            // in conflict are finite.  I had wanted to use some kind of test like 
            // "is_infinite()" on the facet at hand, but this isn't available for 
            // a facet out of context of the triangulation it's part of.

            for(facet_iter = facets.begin(); facet_iter != facets.end(); facet_iter++){
                for(ff_iter = T.finite_facets_begin(); ff_iter != T.finite_facets_end(); ff_iter++){

                    // Since I get an error that facet_iter is actually of type pair, I thought this would work, but it doesn't.
                    // ERROR!
                    cout << facet_iter->first << endl;

                    // This works, which is what led me to believe I was comparing one facet to another facet.
                    /*
                    if(*facet_iter == *ff_iter){
                        cout << "Finite facet!" << endl;
                        break;
                    }*/
                }
            }

In summary:

1) Overall, I want to know which facets from the result of find_conflicts() were finite. If there is an easier way to do this, feel free to let me know.

2) Otherwise, the more specific problem here is that I need to get at that vector of facets that results from find_conflicts() and then get at the vertices of each facet. Am I supposed to be working with the returned "pair" of cells and facets or can I access the vector directly, like I'm trying to do?

Help, please, thanks.

kdottiemo
  • 79
  • 1
  • 8

1 Answers1

0

For finiteness testing, use is_infinite(). See http://doc.cgal.org/latest/Triangulation_3/classCGAL_1_1Triangulation__3.html#af024721d3ae4b9327ffe442fb828935c

Otherwise, maybe you are confused because the Facet type is a typedef to a pair (unfortunately).

PS: alternatively, you can use Marc Glisse's suggestion in your other question (using locate(midpoint(p, sphere center))). It might be easier. CGAL Using Locate() to Find Cell on Triangulation Surface

Community
  • 1
  • 1
Sylvain Pion
  • 575
  • 1
  • 4
  • 11
  • Ahhh, yes. You're good at figuring out my real misunderstanding. It was the latter; so a Facet is described by a cell and a vertex index of that cell that dictates which cell-vertex the facet opposes...a facet is necessarily a triangle in a 3D Delaunay triangulation, right? – kdottiemo Jun 25 '14 at 20:28