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

Union computation failure #19

Closed
manubb opened this issue Apr 25, 2018 · 3 comments
Closed

Union computation failure #19

manubb opened this issue Apr 25, 2018 · 3 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@manubb
Copy link

manubb commented Apr 25, 2018

Using this set of polygons:

const set = [
	[
		[
			[541.0184069121032,-143.03237832156836],
			[538.8976288020026,-123.35535843900269],
			[537.8321066666686,-122.80116457495023],
			[536.8855437278494,-123.35069884911623],
			[538.8870716306947,-141.92129053535714],
			[540.0894577777653,-143.74533713285928]
		]
	],
	[
		[
			[540.7750579535648,-143.21914611949745],
			[540.0894577777653,-143.74533713285928],
			[539.662835668487,-144.64976710575652],
			[539.7288124662978,-144.67804017205043],
			[540.3113546885238,-144.90328991644918],
			[540.6719999999914,-143.97058687725803]
		]
	],
	[
		[
			[557.6320465703087,-141.3264757967004],
			[540.8116376490731,-142.95242750964428],
			[540.6719999999914,-143.97058687725803],
			[541.2045466710015,-144.9237692724459],
			[557.0433079860503,-143.3927089271412],
			[558.1482666666561,-142.28123640691047]
		]
	],
	[
		[
			[532.7840286412132,-156.0428207910487],
			[541.2045466710015,-144.9237692724459],
			[540.6719999999914,-143.97058687725803],
			[539.8748041328679,-143.3668661227355],
			[531.3858333791956,-154.5763074915546],
			[531.7154133333242,-155.79750159024843]
		]
	],
	[
		[
			[538.8870716306947,-141.92129053535714],
			[513.8619652247359,-127.83939169834923],
			[511.28554246236985,-128.25021939873648],
			[511.7826658464412,-128.96424912185236],
			[539.5990569575308,-144.61683414118076],
			[539.662835668487,-144.64976710575652],
			[540.0894577777653,-143.74533713285928]
		]
	]
];

calling:

polygonClipping.union(set[0], set[1], set[2], set[3], set[4]);

fails with:

Error: Unable to complete output ring starting at [539.8561832464202, -143.39145446694468].
Last matching segment found ends at  [539.8561832464202, -143.39145446694462].

The polygons look like:
clipping

@mfogel
Copy link
Owner

mfogel commented Apr 26, 2018

Great, thanks for the bug report. I've reproduced the error on my side and will find time to do a deep dive into this case in the next few days.

Slightly simpler case that still generates the error:

> polygonClipping.union(set[0], set[3], set[4]);
Error: Unable to complete output ring starting at [539.8561832464202, -143.39145446694468]. Last matching segment found ends at  [539.8561832464202, -143.39145446694462].

@mfogel mfogel self-assigned this Apr 26, 2018
@mfogel mfogel added the bug Something isn't working label Apr 26, 2018
@mfogel
Copy link
Owner

mfogel commented May 23, 2018

Simplified geometry that still reproduces the error - take union of these three polygons:

{
  "type": "MultiPolygon",
  "coordinates": [
    [[[541, -42], [538.88, -41.92], [540.09, -43.74]]],
    [[[538, -44], [538.88, -41.92], [540.09, -43.74]]],
    [[[541, -44], [539.87, -43.37], [538.73, -44.88]]]
  ]
}

@mfogel mfogel added this to the 0.7 milestone May 23, 2018
@mfogel mfogel closed this as completed in 4ab6557 May 24, 2018
@mfogel
Copy link
Owner

mfogel commented May 24, 2018

@manubb this should be fixed on master now if you want to give it a try. Running the original polygons you posted through I now get a result of:
screen shot 2018-05-23 at 21 52 22

Thanks for the bug report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants