mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-29 16:22:53 +00:00
And the rest
This commit is contained in:
@@ -6,20 +6,12 @@ bool IfcGeom::CgalKernel::convert_wire_to_face(const cgal_wire_t& wire, cgal_fac
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IfcGeom::CgalKernel::remove_duplicate_points_from_loop(cgal_wire_t& polygon) {
|
void IfcGeom::CgalKernel::remove_duplicate_points_from_loop(cgal_wire_t& polygon) {
|
||||||
if (tol <= 0.) tol = getValue(GV_PRECISION);
|
std::set<cgal_point_t> points;
|
||||||
tol *= tol;
|
|
||||||
|
|
||||||
for (int i = 0; i < polygon.size(); ++i) {
|
for (int i = 0; i < polygon.size(); ++i) {
|
||||||
for (int j = i+1; j < polygon.size(); ++j) {
|
if (points.count(polygon[i])) {
|
||||||
if (CGAL::squared_distance(polygon[i], polygon[j]) < tol) {
|
polygon.erase(polygon.begin()+i);
|
||||||
polygon.erase(polygon.begin()+j);
|
--i;
|
||||||
--j;
|
} else points.insert(polygon[i]);
|
||||||
}
|
|
||||||
} if (closed) {
|
|
||||||
if (CGAL::squared_distance(polygon.front(), polygon.back()) < tol) {
|
|
||||||
polygon.erase(polygon.begin()+polygon.size()-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user