Merge branch 'tm_partarrange_broken_SPE-1302'

This commit is contained in:
tamasmeszaros 2022-09-22 09:39:03 +02:00
commit e7bc232a85

View File

@ -509,28 +509,24 @@ public:
return diff; return diff;
} }
template<class Range = ConstItemRange<typename Base::DefaultIter>>
PackResult trypack(Item& item,
const Range& remaining = Range()) {
auto result = _trypack(item, remaining);
// Experimental
// if(!result) repack(item, result);
return result;
}
~_NofitPolyPlacer() { ~_NofitPolyPlacer() {
clearItems(); clearItems();
} }
inline void clearItems() { inline void clearItems() {
finalAlign(bin_); finalAlign(bin_);
merged_pile_ = {};
Base::clearItems(); Base::clearItems();
} }
void preload(const ItemGroup& packeditems) { void preload(const ItemGroup& packeditems) {
Base::preload(packeditems); Base::preload(packeditems);
for (const Item& itm : packeditems)
merged_pile_.emplace_back(itm.transformedShape());
nfp::merge(merged_pile_);
if (config_.on_preload) if (config_.on_preload)
config_.on_preload(packeditems, config_); config_.on_preload(packeditems, config_);
} }
@ -606,8 +602,9 @@ private:
using Edges = EdgeCache<RawShape>; using Edges = EdgeCache<RawShape>;
public:
template<class Range = ConstItemRange<typename Base::DefaultIter>> template<class Range = ConstItemRange<typename Base::DefaultIter>>
PackResult _trypack( PackResult trypack(
Item& item, Item& item,
const Range& remaining = Range()) { const Range& remaining = Range()) {
@ -897,6 +894,7 @@ private:
return ret; return ret;
} }
private:
inline void finalAlign(const RawShape& pbin) { inline void finalAlign(const RawShape& pbin) {
auto bbin = sl::boundingBox(pbin); auto bbin = sl::boundingBox(pbin);
finalAlign(bbin); finalAlign(bbin);