![]() |
Prusa Slicer 2.6.0
|
#include <src/libnest2d/include/libnest2d/placers/nfpplacer.hpp>
Collaboration diagram for libnest2d::placers::NfpPConfig< RawShape >:Public Types | |
| enum class | Alignment { CENTER , BOTTOM_LEFT , BOTTOM_RIGHT , TOP_LEFT , TOP_RIGHT , DONT_ALIGN } |
| using | ItemGroup = _ItemGroup< RawShape > |
Public Member Functions | |
| NfpPConfig () | |
Public Attributes | |
| std::vector< Radians > | rotations |
| Which angles to try out for better results. | |
| Alignment | alignment |
| Where to align the resulting packed pile. | |
| Alignment | starting_point |
| Where to start putting objects in the bin. | |
| std::function< double(const _Item< RawShape > &)> | object_function |
| A function object representing the fitting function in the placement optimization process. (Optional) | |
| float | accuracy = 0.65f |
| The quality of search for an optimal placement. This is a compromise slider between quality and speed. Zero is the fast and poor solution while 1.0 is the slowest but most accurate. | |
| bool | explore_holes = false |
| If you want to see items inside other item's holes, you have to turn this switch on. | |
| bool | parallel = true |
| If true, use all CPUs available. Run on a single core otherwise. | |
| std::function< void(const nfp::Shapes< RawShape > &, const ItemGroup &, const ItemGroup &)> | before_packing |
| before_packing Callback that is called just before a search for a new item's position is started. You can use this to create various cache structures and update them between subsequent packings. | |
| std::function< void(const ItemGroup &, NfpPConfig &config)> | on_preload |
| using libnest2d::placers::NfpPConfig< RawShape >::ItemGroup = _ItemGroup<RawShape> |
|
strong |
| Enumerator | |
|---|---|
| CENTER | |
| BOTTOM_LEFT | |
| BOTTOM_RIGHT | |
| TOP_LEFT | |
| TOP_RIGHT | |
| DONT_ALIGN |
|
|
inline |
References libnest2d::Pi.
| float libnest2d::placers::NfpPConfig< RawShape >::accuracy = 0.65f |
The quality of search for an optimal placement. This is a compromise slider between quality and speed. Zero is the fast and poor solution while 1.0 is the slowest but most accurate.
| Alignment libnest2d::placers::NfpPConfig< RawShape >::alignment |
Where to align the resulting packed pile.
| std::function<void(const nfp::Shapes<RawShape>&, const ItemGroup&, const ItemGroup& )> libnest2d::placers::NfpPConfig< RawShape >::before_packing |
before_packing Callback that is called just before a search for a new item's position is started. You can use this to create various cache structures and update them between subsequent packings.
| merged | pile A polygon that is the union of all items in the bin. |
| pile | The items parameter is a container with all the placed polygons excluding the current candidate. You can for instance check the alignment with the candidate item or do anything else. |
| remaining | A container with the remaining items waiting to be placed. You can use some features about the remaining items to alter to score of the current placement. If you know that you have to leave place for other items as well, that might influence your decision about where the current candidate should be placed. E.g. imagine three big circles which you want to place into a box: you might place them in a triangle shape which has the maximum pack density. But if there is a 4th big circle than you won't be able to pack it. If you knew apriori that there four circles are to be placed, you would have placed the first 3 into an L shape. This parameter can be used to make these kind of decisions (for you or a more intelligent AI). |
| bool libnest2d::placers::NfpPConfig< RawShape >::explore_holes = false |
If you want to see items inside other item's holes, you have to turn this switch on.
This will only work if a suitable nfp implementation is provided. The library has no such implementation right now.
| std::function<double(const _Item<RawShape>&)> libnest2d::placers::NfpPConfig< RawShape >::object_function |
A function object representing the fitting function in the placement optimization process. (Optional)
This is the most versatile tool to configure the placer. The fitting function is evaluated many times when a new item is being placed into the bin. The output should be a rated score of the new item's position.
This is not a mandatory option as there is a default fitting function that will optimize for the best pack efficiency. With a custom fitting function you can e.g. influence the shape of the arranged pile.
| item | The only parameter is the candidate item which has info about its current position. Your job is to rate this position compared to the already packed items. |
| std::function<void(const ItemGroup &, NfpPConfig &config)> libnest2d::placers::NfpPConfig< RawShape >::on_preload |
| bool libnest2d::placers::NfpPConfig< RawShape >::parallel = true |
If true, use all CPUs available. Run on a single core otherwise.
| std::vector<Radians> libnest2d::placers::NfpPConfig< RawShape >::rotations |
Which angles to try out for better results.
| Alignment libnest2d::placers::NfpPConfig< RawShape >::starting_point |
Where to start putting objects in the bin.