Package org.apache.lucene.geo
Class XTessellator
java.lang.Object
org.apache.lucene.geo.XTessellator
This is a copy of a newer the version of same class from Lucene, one that includes a fix not yet released by Lucene.
Once lucene 8.11 is released with the fix, this class can be deleted.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Circular Doubly-linked list used for polygon coordinatesstatic final class
Triangle in the tessellated mesh -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
linesIntersect
(double aX0, double aY0, double aX1, double aY1, double bX0, double bY0, double bX1, double bY1) Determines whether two line segments intersect.static boolean
pointInPolygon
(List<XTessellator.Triangle> tessellation, double lat, double lon) Brute force compute if a point is in the polygon by traversing entire triangulation todo: speed this up using either binary tree or prefix coding (filtering by bounding box of triangle)static boolean
pointInTriangle
(double x, double y, double ax, double ay, double bx, double by, double cx, double cy) compute whether the given x, y point is in a triangle; uses the winding order methodstatic List<XTessellator.Triangle>
tessellate
(org.apache.lucene.geo.Polygon polygon) static List<XTessellator.Triangle>
tessellate
(org.apache.lucene.geo.XYPolygon polygon)
-
Method Details
-
tessellate
-
tessellate
-
linesIntersect
public static boolean linesIntersect(double aX0, double aY0, double aX1, double aY1, double bX0, double bY0, double bX1, double bY1) Determines whether two line segments intersect. -
pointInTriangle
public static boolean pointInTriangle(double x, double y, double ax, double ay, double bx, double by, double cx, double cy) compute whether the given x, y point is in a triangle; uses the winding order method -
pointInPolygon
public static boolean pointInPolygon(List<XTessellator.Triangle> tessellation, double lat, double lon) Brute force compute if a point is in the polygon by traversing entire triangulation todo: speed this up using either binary tree or prefix coding (filtering by bounding box of triangle)
-