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

add area, translation and rotation attrs to Item #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fitnr
Copy link

@fitnr fitnr commented Feb 14, 2021

This adds translation, rotation and area attributes to the Item class. As I mentioned in #3, this may help with applying textures or image overlays to transformed features.

The returned rotation is in radians. The returned translation is a Point that can be interpreted as a vector.

An example:

import nest2D as n2d
item = n2d.Item([n2d.Point(10, 10), n2d.Point(10, 12), n2d.Point(12, 12), n2d.Point(10, 10)])
packing = n2d.nest([item] * 10, n2d.Box(100, 100))

[p.rotation for p in packing[0]]
# [0.0, 3.141592653589793, 0.0, 1.5707963267948966, 3.141592653589793, 0.0, ...]

[p.translation for p in packing[0]]
# [Point(39, 39), Point(61, 60), Point(38, 40), Point(60, 38), Point(62, 59),  ...]

@chrisvartanian
Copy link

chrisvartanian commented Feb 17, 2021

Disabling Rotation would be a plus as well

@fitnr
Copy link
Author

fitnr commented Feb 20, 2021

If that's a feature of libnest2d, it should theoretically be possible to reflect in the Python bindings. I think it's a little outside of the scope of this update, though.

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

Successfully merging this pull request may close these issues.

2 participants