mirror of https://github.com/CGAL/cgal
CDT3: Fix face_constraint_index()
This commit is contained in:
parent
85ef57ffa1
commit
40ac746be7
|
|
@ -5,6 +5,8 @@
|
|||
#include <CGAL/make_conforming_constrained_Delaunay_triangulation_3.h>
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <list>
|
||||
|
||||
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||
|
||||
|
|
@ -29,6 +31,19 @@ int main(int argc, char* argv[])
|
|||
<< "Number of constrained facets in the CDT: "
|
||||
<< ccdt.number_of_constrained_facets() << '\n';
|
||||
|
||||
// Collect constrained facets per polygon
|
||||
using Facet = typename decltype(ccdt)::Triangulation::Facet;
|
||||
std::vector<std::list<Facet>> constrained_facets(polygons.size());
|
||||
for(auto facet : ccdt.constrained_facets())
|
||||
{
|
||||
int i = ccdt.face_constraint_index(facet);
|
||||
constrained_facets[i].push_back(facet);
|
||||
}
|
||||
auto it = std::max_element(constrained_facets.begin(), constrained_facets.end());
|
||||
|
||||
std::cout << "The polygon with the most constrained facets has index "
|
||||
<< (it - constrained_facets.begin()) << " and " << it->size() << " facets.\n";
|
||||
|
||||
std::ofstream ofs(argc > 2 ? argv[2] : "out.mesh");
|
||||
ofs.precision(17);
|
||||
CGAL::IO::write_MEDIT(ofs, ccdt);
|
||||
|
|
|
|||
|
|
@ -1034,7 +1034,7 @@ public:
|
|||
*/
|
||||
CDT_3_signed_index face_constraint_index(typename Triangulation::Cell_handle ch, int i) const
|
||||
{
|
||||
return ch->face_id[static_cast<unsigned>(i)];
|
||||
return ch->ccdt_3_data().face_constraint_index(i);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public:
|
|||
CGAL::read(is, i);
|
||||
}
|
||||
if(!is) return is;
|
||||
c.face_id[li] = i;
|
||||
c->ccdt_3_data().set_face_constraint_index(li, i);
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue