jpountz commented on a change in pull request #546: LUCENE-8620: LatLonShape 
contains
URL: https://github.com/apache/lucene-solr/pull/546#discussion_r249812595
 
 

 ##########
 File path: 
lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonLineShapeQueries.java
 ##########
 @@ -81,35 +81,52 @@ protected Validator getValidator(QueryRelation 
queryRelation) {
     public boolean testBBoxQuery(double minLat, double maxLat, double minLon, 
double maxLon, Object shape) {
       Line line = (Line)shape;
       Rectangle2D rectangle2D = Rectangle2D.create(new Rectangle(minLat, 
maxLat, minLon, maxLon));
+      EdgeTree.WithinRelation withinRelation = 
EdgeTree.WithinRelation.DISJOINT;
       for (int i = 0, j = 1; j < line.numPoints(); ++i, ++j) {
-        int[] decoded = encodeDecodeTriangle(line.getLon(i), line.getLat(i), 
line.getLon(j), line.getLat(j), line.getLon(i), line.getLat(i));
+        LatLonShape.Triangle decoded = encodeDecodeTriangle(line.getLon(i), 
line.getLat(i), true, line.getLon(j), line.getLat(j), true, line.getLon(i), 
line.getLat(i), true);
         if (queryRelation == QueryRelation.WITHIN) {
-          if (rectangle2D.containsTriangle(decoded[1], decoded[0], decoded[3], 
decoded[2], decoded[5], decoded[4]) == false) {
+          if (rectangle2D.containsTriangle(decoded.aX, decoded.aY, decoded.bX, 
decoded.bY, decoded.cX, decoded.cY) == false) {
             return false;
           }
+        } else if(queryRelation == QueryRelation.CONTAINS) {
+          EdgeTree.WithinRelation relation = 
rectangle2D.withinTriangle(decoded.aX, decoded.aY, decoded.ab, decoded.bX, 
decoded.bY, decoded.bc, decoded.cX, decoded.cY, decoded.ca);
+          if  (relation == EdgeTree.WithinRelation.INTERSECTS) {
 
 Review comment:
   only one space between `if` and `(`? :)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to