mirror of https://github.com/CGAL/cgal
CDT3: Fix face_constraint_index() (#9155)
## Summary of Changes Fix the function and add it in an example so that it gets tested. ## Release Management * Affected package(s): Constraind_triangulation_3 * License and copyright ownership: unchanged
This commit is contained in:
commit
15d96571a1
|
|
@ -5,6 +5,7 @@
|
||||||
#include <CGAL/make_conforming_constrained_Delaunay_triangulation_3.h>
|
#include <CGAL/make_conforming_constrained_Delaunay_triangulation_3.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
|
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||||
|
|
||||||
|
|
@ -29,6 +30,18 @@ int main(int argc, char* argv[])
|
||||||
<< "Number of constrained facets in the CDT: "
|
<< "Number of constrained facets in the CDT: "
|
||||||
<< ccdt.number_of_constrained_facets() << '\n';
|
<< ccdt.number_of_constrained_facets() << '\n';
|
||||||
|
|
||||||
|
// Collect constrained facets per polygon
|
||||||
|
std::vector<std::size_t> constrained_facets(polygons.size());
|
||||||
|
for(auto facet : ccdt.constrained_facets())
|
||||||
|
{
|
||||||
|
int i = ccdt.face_constraint_index(facet);
|
||||||
|
++constrained_facets[i];
|
||||||
|
}
|
||||||
|
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 << " 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);
|
||||||
CGAL::IO::write_MEDIT(ofs, ccdt);
|
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
|
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);
|
CGAL::read(is, i);
|
||||||
}
|
}
|
||||||
if(!is) return is;
|
if(!is) return is;
|
||||||
c.face_id[li] = i;
|
c->ccdt_3_data().set_face_constraint_index(li, i);
|
||||||
}
|
}
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue