Better healing for Glyph shape - remove duplicit points + self intersections

Add search of intersecting points (compared with CGAL)
Triangulation can [optionaly] accept multi points
This commit is contained in:
Filip Sykala - NTB T15p 2022-08-25 13:28:10 +02:00
parent 94f735168c
commit 63121cee2e
18 changed files with 892 additions and 241 deletions

View file

@ -158,6 +158,24 @@ bool has_duplicate_points(std::vector<Point> &&pts)
return false;
}
Points collect_duplications(Points pts /* Copy */)
{
std::stable_sort(pts.begin(), pts.end());
Points duplicits;
const Point *prev = &pts.front();
for (size_t i = 1; i < pts.size(); ++i) {
const Point *act = &pts[i];
if (*prev == *act) {
// duplicit point
if (!duplicits.empty() && duplicits.back() == *act)
continue; // only unique duplicits
duplicits.push_back(*act);
}
prev = act;
}
return duplicits;
}
BoundingBox get_extents(const Points &pts)
{
return BoundingBox(pts);