mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-03 03:54:04 -06:00
Adapt find_new_position is WIP. Cleaning up comments.
This commit is contained in:
parent
299e4f74c7
commit
cb3a586deb
5 changed files with 181 additions and 301 deletions
|
@ -67,6 +67,7 @@ class _Item {
|
|||
} bb_cache_;
|
||||
|
||||
std::function<void(const _Item&, unsigned)> applyfn_;
|
||||
bool fixed_{false};
|
||||
|
||||
public:
|
||||
|
||||
|
@ -143,6 +144,9 @@ public:
|
|||
{
|
||||
if (applyfn_) applyfn_(*this, binidx);
|
||||
}
|
||||
|
||||
inline bool isFixed() const noexcept { return fixed_; }
|
||||
inline void markAsFixed(bool fixed = true) { fixed_ = fixed; }
|
||||
|
||||
/**
|
||||
* @brief Convert the polygon to string representation. The format depends
|
||||
|
|
|
@ -39,6 +39,15 @@ public:
|
|||
|
||||
std::vector<Placer> placers;
|
||||
placers.reserve(last-first);
|
||||
|
||||
std::for_each(first, last, [this](Item& itm) {
|
||||
if(itm.isFixed()) {
|
||||
if(packed_bins_.empty()) packed_bins_.emplace_back();
|
||||
packed_bins_.front().emplace_back(itm);
|
||||
} else {
|
||||
store_.emplace_back(itm);
|
||||
}
|
||||
});
|
||||
|
||||
// If the packed_items array is not empty we have to create as many
|
||||
// placers as there are elements in packed bins and preload each item
|
||||
|
@ -49,8 +58,6 @@ public:
|
|||
placers.back().preload(ig);
|
||||
}
|
||||
|
||||
std::copy(first, last, std::back_inserter(store_));
|
||||
|
||||
auto sortfunc = [](Item& i1, Item& i2) {
|
||||
return i1.area() > i2.area();
|
||||
};
|
||||
|
@ -76,7 +83,6 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
auto it = store_.begin();
|
||||
|
||||
while(it != store_.end() && !cancelled()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue