Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Unique container of Facet_handles

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Unique container of Facet_handles


Chronological Thread 
  • From: Andreas Fabri <>
  • To:
  • Subject: Re: [cgal-discuss] Unique container of Facet_handles
  • Date: Wed, 10 Oct 2007 16:52:09 +0200

Hi Bernhard

Define

operator<(const PFacet_handle& f1, const PFacet_handle& f2)
{
return &*f1 < &*f2;
}

This should work as std::set has less<T> as default comparator
which just calls operator<

andreas


Bernhard Kornberger wrote:
Dear list!

Having a Polyhedron_3 and a vector of critical vertices of it I need
to create a unique container of all Facets containing at least one of
the critical vertices. Something like:

set<PFacet_handle> sCriticalFacets;
for(unsigned i=0;i<criticalIndices.size();++i)
{
Halfedge_around_vertex_circulator circ1,circ2;
circ1=circ2=vHandles[criticalIndices[i]]->vertex_begin();
do
{
sCriticalFacets.insert(circ1->facet());
} while((++circ1)!=circ2);
}

Clearly it does not work because operator< is not defined for
the facet handle. Another idea is storing the facet_handles into
a STL vector and calling sort and unique using a functor:

class func_FacetSort
{
public:
bool operator()(const PFacet_handle fh1,const PFacet_handle fh2) const
{
// return ???
}
};

func_FacetSort fSort;
sort(vCriticalFacets.begin(),vCriticalFacets.end(),fSort);
unique(..);

..but what should this functor return? The only thing I can imagine is
to represent the vertices of the facets as strings and to compare them.
But this seems dirty and moreover this part is time critical. Any ideas
how to generate a container of facet_handles without duplicates?

Thx!
Bernhard



Archive powered by MHonArc 2.6.16.

Top of Page