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

intersects() returns true when it shouldn't #175

Closed
aflorendo opened this issue May 12, 2015 · 4 comments
Closed

intersects() returns true when it shouldn't #175

aflorendo opened this issue May 12, 2015 · 4 comments
Assignees
Milestone

Comments

@aflorendo
Copy link

Hi,

In the following code, jsts says the following 2 geometries (see image below) intersect when they actually don't.
The intersection method correctly returns GEOMETRYCOLLECTION EMPTY.
Issue seems to occur when one of the geometries is a rectangle and the envelopes of the 2 geometries intersect.

var jsts = require('jsts');
var wktReader = new jsts.io.WKTReader();

var geo1 = wktReader.read('POLYGON ((0 7,3 7,3 10,0 10,0 7))');
var geo2 = wktReader.read('POLYGON ((0 0,10 0,10 10,0 0))');

console.log('geo1.intersects(geo2):', geo1.intersects(geo2));
console.log('geo1.intersection(geo2):', geo1.intersection(geo2).toString());

//// output
//geo1.intersects(geo2): true
//geo1.intersection(geo2): GEOMETRYCOLLECTION EMPTY

image

Thank you,
Arnold

@bjornharrtell bjornharrtell self-assigned this May 12, 2015
@bjornharrtell bjornharrtell added this to the 0.17.0 milestone May 12, 2015
@bjornharrtell
Copy link
Owner

Thanks for the detailed report. I've been able to reproduce the issue.

@bjornharrtell
Copy link
Owner

Managed to fix the issue, there was multiple problems in the port for the optimized case with rectangles. Unfortunately there still seem to be an issue with more complex cases - the case "AA - A-hole contains B, boundaries touch in line" in TestRelateAA fail with the new code. I guess that case wasn't hitting the optimized code earlier.

@aflorendo
Copy link
Author

Thank you!!

@bjornharrtell
Copy link
Owner

Found the other case, all tests passing. :) Closing..

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