2d-polygon-boolean icon indicating copy to clipboard operation
2d-polygon-boolean copied to clipboard

Cannot read property 'intersect' of null, generated within collectClipResults

Open richnicholls404 opened this issue 10 years ago • 5 comments

I have been unable to find out exactly why the following causes an issue:

var subject = [ [ 129.25, 43.25 ], [ 127.25, 43.25 ], [ 127.25, 44.25 ], [ 129.25, 44.25 ] ]; var clip = [ [ 129.25, 45.25 ], [ 130.25, 45.25 ], [ 130.25, 43.25 ], [ 129.25, 43.25 ] ]; PolygonBoolean(subject, clip, 'or');

It seems crt is getting set to null within collectClipResults because it is getting replaced with crt.neighbor. This function works fine for hundreds of other attempts with other coordinates.

Thanks for you hard work on this library. It has proved invaluable.

richnicholls404 avatar Mar 18 '15 17:03 richnicholls404

hey, thanks for the issue! I think this has something to do with degeneracies not handled in the original algorithm. #10 will likely to address this, but I haven't had a chance to dig in yet.

may I ask what you are using this lib for?

tmpvar avatar Mar 18 '15 18:03 tmpvar

Hi. Thanks, I'll take a look at the pseudocode and see if I can get it running. If I can I'll let you know. My geometry vocabulary is a bit limited (not quite sure what you mean by degeneracies - so this might just be different wording of what I'm about to write), but it seems to be an issue because the polygons listed above are touching edges/sharing a coordinate, but not overlapping.

I'm currently using the library to calculate if any obstructions collide with a list of geographic regions (and determine the area without obstructions). It's not 100% applicable - because this algorithm detects only boolean operations between 2 overlapping polygon boundaries, I need to run some custom functions first to detect if the obstruction is contained within the region and return region area minus obstruction area. I might just need to run another custom function to see if the two polygons are touching. I hope that makes sense.

Thanks for your help.

richnicholls404 avatar Mar 18 '15 23:03 richnicholls404

Hi, seeing as this library doesn't deal with polygons that share edges, do you know of another one that can handle these kind of booleans? Thanks!

bjnortier avatar May 27 '15 12:05 bjnortier

clipper.js

tmpvar avatar May 27 '15 12:05 tmpvar

Thanks, will have a look

bjnortier avatar May 27 '15 12:05 bjnortier