Skip to content

Conversation

@imatrisciano
Copy link

This PR allows sheet's holes to have holes in them. Holes in the sheet describe the zones where packing is prohibited, with this PR one can have allowed zones inside prohibited zones.

We can now invert the sheet's path and have the library pack only inside a specified zone. Inverting the sheet polygon is as simple as adding a rectangle as big as the viewBox followed by the polygon we want to use as the allowed zone.

Sheet inverting example

allowed_zone.svg (in pink), the place we want to pack into

<svg viewBox="0 0 1000 1000">
	<path d="M100 600 L900 600 L 900 300 L 100 300 Z" fill="pink" stroke="black"/>
</svg>

inverted_allowed_zone.svg (in yellow), the svg to use as a sheet

<svg viewBox="0 0 1000 1000">
	<path d="M0 0 L 1000 0 L 1000 1000 L 0 1000 Z       M100 600 L900 600 L 900 300 L 100 300 Z" fill="yellow" stroke="black"/>
</svg>
Images

allowed_sheet

inverted_allowed_sheet

This effectively solves issue #5

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.

1 participant