mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-14 21:12:02 +08:00
up version to 47.1
fix macos/linux build
This commit is contained in:
parent
eecf28c00c
commit
705edaa7fb
@ -2349,41 +2349,39 @@ end:
|
||||
}
|
||||
|
||||
ExPolygons PrintObject::_offset_holes(double hole_delta, const ExPolygons &polys) const{
|
||||
if (hole_delta != 0.f) {
|
||||
ExPolygons new_polys;
|
||||
for (const ExPolygon &ex_poly : polys) {
|
||||
ExPolygon new_ex_poly(ex_poly);
|
||||
new_ex_poly.holes.clear();
|
||||
for (const Polygon &hole : ex_poly.holes) {
|
||||
//check if convex to reduce it
|
||||
// check whether first point forms a convex angle
|
||||
//note: we allow a deviation of 5.7° (0.01rad = 0.57°)
|
||||
bool ok = true;
|
||||
ok = (hole.points.front().ccw_angle(hole.points.back(), *(hole.points.begin() + 1)) <= PI + 0.1);
|
||||
// check whether points 1..(n-1) form convex angles
|
||||
if (ok)
|
||||
for (Points::const_iterator p = hole.points.begin() + 1; p != hole.points.end() - 1; ++p) {
|
||||
ok = (p->ccw_angle(*(p - 1), *(p + 1)) <= PI + 0.1);
|
||||
if (!ok) break;
|
||||
}
|
||||
|
||||
// check whether last point forms a convex angle
|
||||
ok &= (hole.points.back().ccw_angle(*(hole.points.end() - 2), hole.points.front()) <= PI + 0.1);
|
||||
|
||||
if (ok) {
|
||||
for (Polygon newHole : offset(hole, hole_delta)) {
|
||||
//reverse because it's a hole, not an object
|
||||
newHole.make_clockwise();
|
||||
new_ex_poly.holes.push_back(newHole);
|
||||
}
|
||||
} else {
|
||||
new_ex_poly.holes.push_back(hole);
|
||||
ExPolygons new_polys;
|
||||
for (const ExPolygon &ex_poly : polys) {
|
||||
ExPolygon new_ex_poly(ex_poly);
|
||||
new_ex_poly.holes.clear();
|
||||
for (const Polygon &hole : ex_poly.holes) {
|
||||
//check if convex to reduce it
|
||||
// check whether first point forms a convex angle
|
||||
//note: we allow a deviation of 5.7° (0.01rad = 0.57°)
|
||||
bool ok = true;
|
||||
ok = (hole.points.front().ccw_angle(hole.points.back(), *(hole.points.begin() + 1)) <= PI + 0.1);
|
||||
// check whether points 1..(n-1) form convex angles
|
||||
if (ok)
|
||||
for (Points::const_iterator p = hole.points.begin() + 1; p != hole.points.end() - 1; ++p) {
|
||||
ok = (p->ccw_angle(*(p - 1), *(p + 1)) <= PI + 0.1);
|
||||
if (!ok) break;
|
||||
}
|
||||
|
||||
// check whether last point forms a convex angle
|
||||
ok &= (hole.points.back().ccw_angle(*(hole.points.end() - 2), hole.points.front()) <= PI + 0.1);
|
||||
|
||||
if (ok) {
|
||||
for (Polygon newHole : offset(hole, hole_delta)) {
|
||||
//reverse because it's a hole, not an object
|
||||
newHole.make_clockwise();
|
||||
new_ex_poly.holes.push_back(newHole);
|
||||
}
|
||||
} else {
|
||||
new_ex_poly.holes.push_back(hole);
|
||||
}
|
||||
new_polys.push_back(new_ex_poly);
|
||||
}
|
||||
return new_polys;
|
||||
new_polys.push_back(new_ex_poly);
|
||||
}
|
||||
return new_polys;
|
||||
}
|
||||
|
||||
/// max angle: you ahve to be lwer than that to divide it. PI => all accepted
|
||||
|
@ -5,5 +5,5 @@ set(SLIC3R_APP_NAME "Slic3r++")
|
||||
set(SLIC3R_APP_KEY "Slic3r++")
|
||||
set(SLIC3R_VERSION "2.2.47")
|
||||
set(SLIC3R_BUILD_ID "slic3r++_${SLIC3R_VERSION}+UNKNOWN")
|
||||
set(SLIC3R_RC_VERSION "2,2,47,0")
|
||||
set(SLIC3R_RC_VERSION_DOTS "2.2.47.0")
|
||||
set(SLIC3R_RC_VERSION "2,2,47,1")
|
||||
set(SLIC3R_RC_VERSION_DOTS "2.2.47.1")
|
||||
|
Loading…
x
Reference in New Issue
Block a user