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

Polygon union of rectangles produces inconsistent result #19

Closed
mazznoer opened this issue Jan 10, 2020 · 1 comment
Closed

Polygon union of rectangles produces inconsistent result #19

mazznoer opened this issue Jan 10, 2020 · 1 comment

Comments

@mazznoer
Copy link

mazznoer commented Jan 10, 2020

let rects = [
	[ // rect 1
		[10,10],
		[20,10],
		[20,20],
		[10,20],
	],[ // rect 2
		[20,20],
		[30,20],
		[30,30],
		[20,30],
	],[ // rect 3
		[10,30],
		[20,30],
		[20,40],
		[10,40],
	],
];

let poly = PolyBool.union({
	regions: rects,
	inverted: false,
}, {
	regions: [],
	inverted: false,
});

svgx-1578646604

Why rect 1 and rect 2 is not merged, but rect 2 and rect 3 is merged?

Is there any way to disable this corner to corner union?

Sorry for my broken english.

@velipso
Copy link
Owner

velipso commented Jun 18, 2020

Sorry for the late reply, I don't check here very often anymore.

To answer your question: the library does not make promises about how the final object is built, other than it will be the correct boolean result. It could have just as easily created three regions.

The result is correct, as far as the library is concerned. If you want to do further simplification by attempting to combine regions, then that's outside the scope of this library.

@velipso velipso closed this as completed Jun 18, 2020
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