Package org.apache.lucene.geo
Class Rectangle2D
- java.lang.Object
-
- org.apache.lucene.geo.Rectangle2D
-
public class Rectangle2D extends java.lang.Object
2D rectangle implementation containing geo spatial logic.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Rectangle2D(double minLat, double maxLat, double minLon, double maxLon)
protected
Rectangle2D(int minX, int maxX, int minY, int maxY)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static boolean
bboxContainsPoint(int x, int y, int minX, int maxX, int minY, int maxY)
static utility method to check if a bounding box contains a pointprivate static boolean
bboxContainsTriangle(int ax, int ay, int bx, int by, int cx, int cy, int minX, int maxX, int minY, int maxY)
static utility method to check if a bounding box contains a triangleprivate static boolean
boxesAreDisjoint(int aMinX, int aMaxX, int aMinY, int aMaxY, int bMinX, int bMaxX, int bMinY, int bMaxY)
utility method to check if two boxes are disjointprivate static PointValues.Relation
compareBBoxToRangeBBox(byte[] bbox, int minXOffset, int minYOffset, byte[] minTriangle, int maxXOffset, int maxYOffset, byte[] maxTriangle)
static utility method to compare a bbox with a range of triangles (just the bbox of the triangle collection)boolean
containsTriangle(int ax, int ay, int bx, int by, int cx, int cy)
Checks if the rectangle contains the provided trianglestatic Rectangle2D
create(Rectangle rectangle)
Builds a Rectangle2D from rectangleboolean
crossesDateline()
private static boolean
disjoint(byte[] bbox, int minXOffset, int minYOffset, byte[] minTriangle, int maxXOffset, int maxYOffset, byte[] maxTriangle)
static utility method to check a bbox is disjoint with a range of trianglesprivate static boolean
edgeIntersectsBox(int ax, int ay, int bx, int by, int minX, int maxX, int minY, int maxY)
returns true if the edge (defined by (ax, ay) (bx, by)) intersects the queryprivate boolean
edgeIntersectsQuery(int ax, int ay, int bx, int by)
returns true if the edge (defined by (ax, ay) (bx, by)) intersects the queryprivate static void
encode(int minX, int maxX, int minY, int maxY, byte[] b)
encodes a bounding box into the provided byte arrayboolean
equals(java.lang.Object o)
int
hashCode()
private static PointValues.Relation
intersectBBoxWithRangeBBox(byte[] bbox, int minXOffset, int minYOffset, byte[] minTriangle, int maxXOffset, int maxYOffset, byte[] maxTriangle)
static utility method to compare a bbox with a range of triangles (just the bbox of the triangle collection) for intersectionPointValues.Relation
intersectRangeBBox(int minXOffset, int minYOffset, byte[] minTriangle, int maxXOffset, int maxYOffset, byte[] maxTriangle)
intersects this to a provided range bounding boxboolean
intersectsTriangle(int aX, int aY, int bX, int bY, int cX, int cY)
Checks if the rectangle intersects the provided triangleboolean
queryContainsPoint(int x, int y)
Checks if the rectangle contains the provided pointprivate boolean
queryIntersects(int ax, int ay, int bx, int by, int cx, int cy)
returns true if the query intersects the provided triangle (in encoded space)PointValues.Relation
relateRangeBBox(int minXOffset, int minYOffset, byte[] minTriangle, int maxXOffset, int maxYOffset, byte[] maxTriangle)
compare this to a provided range bounding boxComponent2D.WithinRelation
withinTriangle(int ax, int ay, boolean ab, int bx, int by, boolean bc, int cx, int cy, boolean ca)
Returns the Within relation to the provided triangle
-
-
-
Method Detail
-
create
public static Rectangle2D create(Rectangle rectangle)
Builds a Rectangle2D from rectangle
-
crossesDateline
public boolean crossesDateline()
-
queryContainsPoint
public boolean queryContainsPoint(int x, int y)
Checks if the rectangle contains the provided point
-
relateRangeBBox
public PointValues.Relation relateRangeBBox(int minXOffset, int minYOffset, byte[] minTriangle, int maxXOffset, int maxYOffset, byte[] maxTriangle)
compare this to a provided range bounding box
-
intersectRangeBBox
public PointValues.Relation intersectRangeBBox(int minXOffset, int minYOffset, byte[] minTriangle, int maxXOffset, int maxYOffset, byte[] maxTriangle)
intersects this to a provided range bounding box
-
intersectsTriangle
public boolean intersectsTriangle(int aX, int aY, int bX, int bY, int cX, int cY)
Checks if the rectangle intersects the provided triangle
-
withinTriangle
public Component2D.WithinRelation withinTriangle(int ax, int ay, boolean ab, int bx, int by, boolean bc, int cx, int cy, boolean ca)
Returns the Within relation to the provided triangle
-
containsTriangle
public boolean containsTriangle(int ax, int ay, int bx, int by, int cx, int cy)
Checks if the rectangle contains the provided triangle
-
compareBBoxToRangeBBox
private static PointValues.Relation compareBBoxToRangeBBox(byte[] bbox, int minXOffset, int minYOffset, byte[] minTriangle, int maxXOffset, int maxYOffset, byte[] maxTriangle)
static utility method to compare a bbox with a range of triangles (just the bbox of the triangle collection)
-
intersectBBoxWithRangeBBox
private static PointValues.Relation intersectBBoxWithRangeBBox(byte[] bbox, int minXOffset, int minYOffset, byte[] minTriangle, int maxXOffset, int maxYOffset, byte[] maxTriangle)
static utility method to compare a bbox with a range of triangles (just the bbox of the triangle collection) for intersection
-
disjoint
private static boolean disjoint(byte[] bbox, int minXOffset, int minYOffset, byte[] minTriangle, int maxXOffset, int maxYOffset, byte[] maxTriangle)
static utility method to check a bbox is disjoint with a range of triangles
-
encode
private static void encode(int minX, int maxX, int minY, int maxY, byte[] b)
encodes a bounding box into the provided byte array
-
queryIntersects
private boolean queryIntersects(int ax, int ay, int bx, int by, int cx, int cy)
returns true if the query intersects the provided triangle (in encoded space)
-
edgeIntersectsQuery
private boolean edgeIntersectsQuery(int ax, int ay, int bx, int by)
returns true if the edge (defined by (ax, ay) (bx, by)) intersects the query
-
bboxContainsPoint
private static boolean bboxContainsPoint(int x, int y, int minX, int maxX, int minY, int maxY)
static utility method to check if a bounding box contains a point
-
bboxContainsTriangle
private static boolean bboxContainsTriangle(int ax, int ay, int bx, int by, int cx, int cy, int minX, int maxX, int minY, int maxY)
static utility method to check if a bounding box contains a triangle
-
edgeIntersectsBox
private static boolean edgeIntersectsBox(int ax, int ay, int bx, int by, int minX, int maxX, int minY, int maxY)
returns true if the edge (defined by (ax, ay) (bx, by)) intersects the query
-
boxesAreDisjoint
private static boolean boxesAreDisjoint(int aMinX, int aMaxX, int aMinY, int aMaxY, int bMinX, int bMaxX, int bMinY, int bMaxY)
utility method to check if two boxes are disjoint
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-