Skip to content
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

Merged
merged 7 commits into from
Sep 9, 2019

Conversation

iverase
Copy link
Contributor

@iverase iverase commented Jul 9, 2019

This information is then encoded and triangles are decoded using LatLonShape.decodeTriangle.

Relates to #608

Copy link
Member

@nknize nknize left a 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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Member

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
Copy link
Member

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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) {

@nknize
Copy link
Member

nknize commented Sep 6, 2019

Awesome. LGTM! Thanks!

@iverase iverase merged commit 62001b9 into apache:master Sep 9, 2019
asfgit pushed a commit that referenced this pull request Sep 9, 2019
@iverase iverase deleted the edgeFromPolygon2 branch September 9, 2019 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants