[ https://issues.apache.org/jira/browse/LUCENE-8245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16431777#comment-16431777 ]
Ignacio Vera commented on LUCENE-8245: -------------------------------------- I attached the patches: case3: Contains three test cases. 1) The first cases seems to fail because we need to increase the envelope for asserting if we need to look for inner and outer crossings. The following seems to help: {code:java} final GeoPoint[] travelCrossings = travelPlane.findIntersections(planetModel, edge.plane, checkPointCutoffPlane, checkPointOtherCutoffPlane, edge.startPlane, edge.endPlane); if (travelCrossings != null && travelCrossings.length == 0) { final GeoPoint[] testPointCrossings = testPointPlane.findIntersections(planetModel, edge.plane, testPointCutoffPlane, testPointOtherCutoffPlane, edge.startPlane, edge.endPlane); if (testPointCrossings != null && testPointCrossings.length == 0) { // As a last resort, see if the edge endpoints are on either plane. This is sometimes necessary because the // intersection computation logic might not detect near-miss edges otherwise. if (Math.abs(travelPlane.evaluate(edge.startPoint)) > Plane.MINIMUM_PLANE_OFFSET && Math.abs(travelPlane.evaluate(edge.endPoint)) > Plane.MINIMUM_PLANE_OFFSET && Math.abs(testPointPlane.evaluate(edge.startPoint)) > Plane.MINIMUM_PLANE_OFFSET && Math.abs(testPointPlane.evaluate(edge.endPoint)) > Plane.MINIMUM_PLANE_OFFSET) { return true; } } }{code} 2) We miss crossings but the end point or start point are actually on the plane. I have changed the way we count crossings and it seems to help: {code:java} if (testPointInnerCrossings != null && testPointInnerCrossings.length > 0) { for (final GeoPoint crossing : testPointInnerCrossings) { //System.out.println(" Test point inner point "+crossing+"; edgeplane="+edge.plane.evaluate(crossing)+"; testPointInsidePlane="+testPointInsidePlane.evaluate(crossing)+"; edgestartplane="+edge.startPlane.evaluate(crossing)+"; edgeendplane="+edge.endPlane.evaluate(crossing)); countingHash.add(crossing); } } else if (testPointOuterCrossings != null && testPointOuterCrossings.length > 0) { if (testPointInsidePlane.evaluateIsZero(edge.endPoint) || testPointInsidePlane.evaluateIsZero(edge.startPoint)) { countingHash.add(edge.endPoint); } }{code} I added the random test I am using to uncover all these cases. It still gets spurious errors but after the changes above they don't seem related with this case. The last patch is my version of GeoComplexPolygon. > GeoComplexPolygon fails when intersection of travel plane with edge is near > polygon point > ----------------------------------------------------------------------------------------- > > Key: LUCENE-8245 > URL: https://issues.apache.org/jira/browse/LUCENE-8245 > Project: Lucene - Core > Issue Type: Bug > Components: modules/spatial3d > Reporter: Ignacio Vera > Assignee: Karl Wright > Priority: Major > Fix For: 6.7, 7.4, master (8.0) > > Attachments: LUCENE-8245-case2.patch, LUCENE-8245.jpg, > LUCENE-8245.patch, LUCENE-8245_Polygon.patch, LUCENE-8245_Random.patch, > LUCENE-8245_case3.patch > > > When a travel plane crosses an edge close to an edge point , it is possible > that the above and below planes crosses different edges. In the current > implementation one of the crosses is missed because we only check edges that > are crossed by the main plain and the {{within}} result is wrong. > One possible fix is to check always the intersection of planes and edges > regardless if they are crossed by main plane. That fixed the above issue but > shows other issues like travel planes crossing two edges when it should be > only one due to the fuzziness at edge intersections. > Not sure of a fix so I add the test showing the issue. > > -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org