nknize commented on a change in pull request #771: LUCENE-8620: Update
Tessellator logic to label if triangle edges belongs to the original polygon
URL: https://github.com/apache/lucene-solr/pull/771#discussion_r321719001
##########
File path: lucene/sandbox/src/java/org/apache/lucene/geo/Tessellator.java
##########
@@ -873,13 +998,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
Review comment:
:+1:
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]