Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple random results? #22

Open
noamgat opened this issue Nov 25, 2020 · 1 comment
Open

Multiple random results? #22

noamgat opened this issue Nov 25, 2020 · 1 comment

Comments

@noamgat
Copy link

noamgat commented Nov 25, 2020

Hi,
For my use case, I would like to get multiple (hopefully significantly different) nestings of polygons in a certain space. Is this possible / documented somewhere?

@tamasmeszaros
Copy link
Owner

tamasmeszaros commented Nov 27, 2020

Hello! This is not easy but you can change the object function of the NfpPlacer. It takes an item as the argument and you can evaluate its transformation. The default object function simply calculates the distance between the bin center and the item's bounding box center and chooses the placement where its the shortest. A normalized distance is returned as the score.

You could use different object functions like the smallest area of the convex hull of all the items in the bin (including the one received as argument). You can try to mix different measures to create some sort of score, or repeat the arrangement and choose the one which suits your purpose the most.

Currently there is one major difficulty which is to keep the items in the bin. Normally that should be taken care of the framework but currently you need to reject out-of-bin positions in the object function with some penalty to the returned score.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants