-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
LUCENE-8620: Update Tessellator logic to label if triangle edges belongs to the original polygon #771
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few nitpicky suggestions but otherwise this is looking good.
@@ -590,14 +601,123 @@ private static final boolean splitEarcut(Object polygon, final Node start, final | |||
return false; | |||
} | |||
|
|||
/** Computes if edge defined by a and b overlaps with a polygon edge **/ | |||
private static boolean edgeFromPolygon(final Node a, final Node b, final boolean isMorton) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static boolean edgeFromPolygon(final Node a, final Node b, final boolean isMorton) { | |
private static boolean isEdgeFromPolygon(final Node a, final Node b, final boolean isMortonOptimized) { |
} | ||
|
||
/** Uses morton code for speed to determine whether or not and edge defined by a and b overlaps with a polygon edge */ | ||
private static final boolean mortonEdgeFromPolygon(final Node a, final Node b) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static final boolean mortonEdgeFromPolygon(final Node a, final Node b) { | |
private static final boolean isMortonEdgeFromPolygon(final Node a, final Node b) { |
return false; | ||
} | ||
|
||
private static boolean pointInLine(final Node a, final Node b, final Node point) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static boolean pointInLine(final Node a, final Node b, final Node point) { | |
private static boolean isPointInLine(final Node a, final Node b, final Node point) { |
return pointInLine(a, b, point.getX(), point.getY()); | ||
} | ||
|
||
private static boolean pointInLine(final Node a, final Node b, final double lon, final double lat) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static boolean pointInLine(final Node a, final Node b, final double lon, final double lat) { | |
private static boolean isPointInLine(final Node a, final Node b, final double lon, final double lat) { |
} | ||
|
||
|
||
/** Links two polygon vertices using a bridge. **/ /** Links two polygon vert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dangling comment?
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -920,6 +1055,8 @@ public static final boolean pointInPolygon(final List<Triangle> tessellation, do | |||
private Node previousZ; | |||
// next z node | |||
private Node nextZ; | |||
// if the edge from this node to the next node is part of the polygon edges | |||
private boolean nextEdgeFromPolygon; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private boolean nextEdgeFromPolygon; | |
private boolean isNextEdgeFromPolygon; |
|
||
protected Triangle(Node a, Node b, Node c) { | ||
protected Triangle(Node a, boolean abFromPolygon, Node b, boolean bcFromPolygon, Node c, boolean caFromPolygon) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protected Triangle(Node a, boolean abFromPolygon, Node b, boolean bcFromPolygon, Node c, boolean caFromPolygon) { | |
protected Triangle(Node a, boolean isABfromPolygon, Node b, boolean isBCfromPolygon, Node c, boolean isCAfromPolygon) { |
@@ -1004,6 +1145,11 @@ public double getX(int vertex) { | |||
return this.vertex[vertex].getX(); | |||
} | |||
|
|||
/** get if edge is shared with the polygon for the given edge */ | |||
public boolean fromPolygon(int vertex) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public boolean fromPolygon(int vertex) { | |
public boolean isEdgeFromPolygon(int startVertex) { |
assertEquals(t.fromPolygon(2), edgeFromPolygon(p, t.getX(2), t.getY(2), t.getX(0), t.getY(0))); | ||
} | ||
|
||
private boolean edgeFromPolygon(Polygon p, double aLon, double aLat, double bLon, double bLat) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private boolean edgeFromPolygon(Polygon p, double aLon, double aLat, double bLon, double bLat) { | |
private boolean isEdgeFromPolygon(Polygon p, double aLon, double aLat, double bLon, double bLat) { |
Awesome. LGTM! Thanks! |
…ngs to the original polygon (#771)
This information is then encoded and triangles are decoded using LatLonShape.decodeTriangle.
Relates to #608