mirror of https://github.com/CGAL/cgal
simplify the code
This commit is contained in:
parent
40ac746be7
commit
8e3a59a27b
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <list>
|
|
||||||
|
|
||||||
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
|
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||||
|
|
||||||
|
|
@ -32,17 +31,16 @@ int main(int argc, char* argv[])
|
||||||
<< ccdt.number_of_constrained_facets() << '\n';
|
<< ccdt.number_of_constrained_facets() << '\n';
|
||||||
|
|
||||||
// Collect constrained facets per polygon
|
// Collect constrained facets per polygon
|
||||||
using Facet = typename decltype(ccdt)::Triangulation::Facet;
|
std::vector<std::size_t> constrained_facets(polygons.size());
|
||||||
std::vector<std::list<Facet>> constrained_facets(polygons.size());
|
|
||||||
for(auto facet : ccdt.constrained_facets())
|
for(auto facet : ccdt.constrained_facets())
|
||||||
{
|
{
|
||||||
int i = ccdt.face_constraint_index(facet);
|
int i = ccdt.face_constraint_index(facet);
|
||||||
constrained_facets[i].push_back(facet);
|
++constrained_facets[i];
|
||||||
}
|
}
|
||||||
auto it = std::max_element(constrained_facets.begin(), constrained_facets.end());
|
auto it = std::max_element(constrained_facets.begin(), constrained_facets.end());
|
||||||
|
|
||||||
std::cout << "The polygon with the most constrained facets has index "
|
std::cout << "The polygon with the most constrained facets has index "
|
||||||
<< (it - constrained_facets.begin()) << " and " << it->size() << " facets.\n";
|
<< (it - constrained_facets.begin()) << " and " << *it << " facets.\n";
|
||||||
|
|
||||||
std::ofstream ofs(argc > 2 ? argv[2] : "out.mesh");
|
std::ofstream ofs(argc > 2 ? argv[2] : "out.mesh");
|
||||||
ofs.precision(17);
|
ofs.precision(17);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue