Initial port of organic tree support from PrusaSlicer (#1938)

* Initial port of organic tree support from PrusaSlicer

* Port missing Organic support parameters from PrusaSlicer

* Update parameter naming

* Reorganize the `raft_first_layer_expansion` and `raft_first_layer_density` parameters as they are not only used by rafts

* Reset support style only in simple mode

* Sync latest update from PrusaSlicer & copyrights

* Fix organic tree support crash with invalid parameters

---------

Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com>
This commit is contained in:
Noisyfox 2023-09-02 17:29:43 +08:00 committed by GitHub
parent b50dfb69a2
commit a1464735ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 13299 additions and 38 deletions

View file

@ -282,6 +282,10 @@ template<class T> size_t next_highest_power_of_2(T v,
return next_highest_power_of_2(uint32_t(v));
}
template <class VectorType> void reserve_power_of_2(VectorType &vector, size_t n) {
vector.reserve(next_highest_power_of_2(n));
}
template<typename INDEX_TYPE>
inline INDEX_TYPE prev_idx_modulo(INDEX_TYPE idx, const INDEX_TYPE count)
{
@ -298,6 +302,14 @@ inline INDEX_TYPE next_idx_modulo(INDEX_TYPE idx, const INDEX_TYPE count)
return idx;
}
// Return dividend divided by divisor rounded to the nearest integer
template<typename INDEX_TYPE>
inline INDEX_TYPE round_up_divide(const INDEX_TYPE dividend, const INDEX_TYPE divisor)
{
return (dividend + divisor - 1) / divisor;
}
template<typename CONTAINER_TYPE>
inline typename CONTAINER_TYPE::size_type prev_idx_modulo(typename CONTAINER_TYPE::size_type idx, const CONTAINER_TYPE &container)
{