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

 ##########
 File path: lucene/sandbox/src/java/org/apache/lucene/geo/Tessellator.java
 ##########
 @@ -723,13 +735,23 @@ private static boolean pointInEar(final double x, final 
double y, final double a
 
   /** compute whether the given x, y point is in a triangle; uses the winding 
order method */
   public static boolean pointInTriangle (double x, double y, double ax, double 
ay, double bx, double by, double cx, double cy) {
-    int a = orient(x, y, ax, ay, bx, by);
-    int b = orient(x, y, bx, by, cx, cy);
-    if (a == 0 || b == 0 || a < 0 == b < 0) {
-      int c = orient(x, y, cx, cy, ax, ay);
-      return c == 0 || (c < 0 == (b < 0 || a < 0));
+    double minX = StrictMath.min(ax, StrictMath.min(bx, cx));
+    double minY = StrictMath.min(ay, StrictMath.min(by, cy));
+    double maxX = StrictMath.max(ax, StrictMath.max(bx, cx));
+    double maxY = StrictMath.max(ay, StrictMath.max(by, cy));
+    //check the bounding box because if the triangle is degenerated, e.g 
points and lines, we need to filter out
+    //coplanar points that are not part of the triangle.
 
 Review comment:
   ++

----------------------------------------------------------------
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