mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 09:17:52 -06:00
Fixes some ModelArrange warnings
This commit is contained in:
parent
14b32c4f16
commit
6ff434aba3
2 changed files with 10 additions and 17 deletions
|
@ -242,15 +242,6 @@ template<class C> bool all_of(const C &container)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class X, class Y> inline X ceil_i(X x, Y y)
|
|
||||||
{
|
|
||||||
static_assert(std::is_integral<X>::value &&
|
|
||||||
std::is_integral<Y>::value && sizeof(X) >= sizeof(Y),
|
|
||||||
"");
|
|
||||||
|
|
||||||
return (x % y) ? x / y + 1 : x / y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// A shorter C++14 style form of the enable_if metafunction
|
// A shorter C++14 style form of the enable_if metafunction
|
||||||
template<bool B, class T>
|
template<bool B, class T>
|
||||||
using enable_if_t = typename std::enable_if<B, T>::type;
|
using enable_if_t = typename std::enable_if<B, T>::type;
|
||||||
|
|
|
@ -63,9 +63,9 @@ std::string toString(const Model& model, bool holes = true) {
|
||||||
ExPolygons expolys = tmpmesh.horizontal_projection();
|
ExPolygons expolys = tmpmesh.horizontal_projection();
|
||||||
for(auto& expoly_complex : expolys) {
|
for(auto& expoly_complex : expolys) {
|
||||||
|
|
||||||
auto tmp = expoly_complex.simplify(1.0/SCALING_FACTOR);
|
ExPolygons tmp = expoly_complex.simplify(scaled<double>(1.));
|
||||||
if(tmp.empty()) continue;
|
if(tmp.empty()) continue;
|
||||||
auto expoly = tmp.front();
|
ExPolygon expoly = tmp.front();
|
||||||
expoly.contour.make_clockwise();
|
expoly.contour.make_clockwise();
|
||||||
for(auto& h : expoly.holes) h.make_counter_clockwise();
|
for(auto& h : expoly.holes) h.make_counter_clockwise();
|
||||||
|
|
||||||
|
@ -633,8 +633,8 @@ ShapeData2D projectModelFromTop(const Slic3r::Model &model,
|
||||||
if(item.vertexCount() > 3) {
|
if(item.vertexCount() > 3) {
|
||||||
item.rotation(Geometry::rotation_diff_z(rotation0, objinst->get_rotation()));
|
item.rotation(Geometry::rotation_diff_z(rotation0, objinst->get_rotation()));
|
||||||
item.translation({
|
item.translation({
|
||||||
ClipperLib::cInt(objinst->get_offset(X)/SCALING_FACTOR),
|
scaled<ClipperLib::cInt>(objinst->get_offset(X)),
|
||||||
ClipperLib::cInt(objinst->get_offset(Y)/SCALING_FACTOR)
|
scaled<ClipperLib::cInt>(objinst->get_offset(Y))
|
||||||
});
|
});
|
||||||
ret.emplace_back(objinst, item);
|
ret.emplace_back(objinst, item);
|
||||||
}
|
}
|
||||||
|
@ -658,8 +658,8 @@ ShapeData2D projectModelFromTop(const Slic3r::Model &model,
|
||||||
Item item(std::move(pn));
|
Item item(std::move(pn));
|
||||||
item.rotation(wti.rotation),
|
item.rotation(wti.rotation),
|
||||||
item.translation({
|
item.translation({
|
||||||
ClipperLib::cInt(wti.pos(0)/SCALING_FACTOR),
|
scaled<ClipperLib::cInt>(wti.pos(0)),
|
||||||
ClipperLib::cInt(wti.pos(1)/SCALING_FACTOR)
|
scaled<ClipperLib::cInt>(wti.pos(1))
|
||||||
});
|
});
|
||||||
ret.emplace_back(nullptr, item);
|
ret.emplace_back(nullptr, item);
|
||||||
}
|
}
|
||||||
|
@ -822,7 +822,9 @@ bool arrange(Model &model, // The model with the geometries
|
||||||
|
|
||||||
auto& cfn = stopcondition;
|
auto& cfn = stopcondition;
|
||||||
|
|
||||||
coord_t md = ceil_i(min_obj_distance, 2) - SCALED_EPSILON;
|
// Integer ceiling the min distance from the bed perimeters
|
||||||
|
coord_t md = min_obj_distance - SCALED_EPSILON;
|
||||||
|
md = (md % 2) ? md / 2 + 1 : md / 2;
|
||||||
|
|
||||||
auto binbb = Box({libnest2d::Coord{bbb.min(0)} - md,
|
auto binbb = Box({libnest2d::Coord{bbb.min(0)} - md,
|
||||||
libnest2d::Coord{bbb.min(1)} - md},
|
libnest2d::Coord{bbb.min(1)} - md},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue