Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
libnest2d::placers::NfpPConfig< RawShape > Struct Template Reference

#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< Radiansrotations
 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
 

Detailed Description

template<class RawShape>
struct libnest2d::placers::NfpPConfig< RawShape >

Member Typedef Documentation

◆ ItemGroup

template<class RawShape >
using libnest2d::placers::NfpPConfig< RawShape >::ItemGroup = _ItemGroup<RawShape>

Member Enumeration Documentation

◆ Alignment

template<class RawShape >
enum class libnest2d::placers::NfpPConfig::Alignment
strong
Enumerator
CENTER 
BOTTOM_LEFT 
BOTTOM_RIGHT 
TOP_LEFT 
TOP_RIGHT 
DONT_ALIGN 

‍Warning: parts may end up outside the bin with the default object function.

Constructor & Destructor Documentation

◆ NfpPConfig()

template<class RawShape >
libnest2d::placers::NfpPConfig< RawShape >::NfpPConfig ( )
inline
122 : rotations({0.0, Pi/2.0, Pi, 3*Pi/2}),
const double BP2D_CONSTEXPR Pi
Definition common.hpp:97
Alignment starting_point
Where to start putting objects in the bin.
Definition nfpplacer.hpp:50
Alignment alignment
Where to align the resulting packed pile.
Definition nfpplacer.hpp:47
std::vector< Radians > rotations
Which angles to try out for better results.
Definition nfpplacer.hpp:44

References libnest2d::Pi.

Member Data Documentation

◆ accuracy

template<class RawShape >
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

template<class RawShape >
Alignment libnest2d::placers::NfpPConfig< RawShape >::alignment

Where to align the resulting packed pile.

◆ before_packing

template<class RawShape >
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.

Parameters
mergedpile A polygon that is the union of all items in the bin.
pileThe 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.
remainingA 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).

◆ explore_holes

template<class RawShape >
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.

◆ object_function

template<class RawShape >
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.

Parameters
itemThe 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.

◆ on_preload

template<class RawShape >
std::function<void(const ItemGroup &, NfpPConfig &config)> libnest2d::placers::NfpPConfig< RawShape >::on_preload

◆ parallel

template<class RawShape >
bool libnest2d::placers::NfpPConfig< RawShape >::parallel = true

If true, use all CPUs available. Run on a single core otherwise.

◆ rotations

template<class RawShape >
std::vector<Radians> libnest2d::placers::NfpPConfig< RawShape >::rotations

Which angles to try out for better results.

◆ starting_point

template<class RawShape >
Alignment libnest2d::placers::NfpPConfig< RawShape >::starting_point

Where to start putting objects in the bin.


The documentation for this struct was generated from the following file: