Package org.apache.lucene.geo
Class Line2D
- java.lang.Object
-
- org.apache.lucene.geo.Line2D
-
- All Implemented Interfaces:
Component2D
final class Line2D extends java.lang.Object implements Component2D
2D geo line implementation represented as a balanced interval tree of edges.Line
Line2D
Construction takesO(n log n)
time for sorting and tree construction.relate()
areO(n)
, but for most practical lines are much faster than brute force.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.lucene.geo.Component2D
Component2D.WithinRelation
-
-
Field Summary
Fields Modifier and Type Field Description private double
maxX
maximum X of this geometry's bounding box areaprivate double
maxY
maximum Y of this geometry's bounding box areaprivate double
minX
minimum X of this geometry's bounding box areaprivate double
minY
minimum Y of this geometry's bounding box areaprivate EdgeTree
tree
lines represented as a 2-d interval tree.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(double x, double y)
relates this component2D with a pointboolean
containsLine(double minX, double maxX, double minY, double maxY, double aX, double aY, double bX, double bY)
return true if this component2D contains the provided lineboolean
containsTriangle(double minX, double maxX, double minY, double maxY, double aX, double aY, double bX, double bY, double cX, double cY)
return true if this component2D contains the provided triangle(package private) static Component2D
create(Line line)
create a Line2D from the provided LatLon Linestring(package private) static Component2D
create(XYLine line)
create a Line2D from the provided XY Linestringdouble
getMaxX()
max X value for the componentdouble
getMaxY()
max Y value for the componentdouble
getMinX()
min X value for the componentdouble
getMinY()
min Y value for the componentboolean
intersectsLine(double minX, double maxX, double minY, double maxY, double aX, double aY, double bX, double bY)
return true if this component2D intersects the provided lineboolean
intersectsTriangle(double minX, double maxX, double minY, double maxY, double aX, double aY, double bX, double bY, double cX, double cY)
return true if this component2D intersects the provided trianglePointValues.Relation
relate(double minX, double maxX, double minY, double maxY)
relates this component2D with a bounding boxComponent2D.WithinRelation
withinLine(double minX, double maxX, double minY, double maxY, double aX, double aY, boolean ab, double bX, double bY)
Compute the within relation of this component2D with a lineComponent2D.WithinRelation
withinPoint(double x, double y)
Compute the within relation of this component2D with a pointComponent2D.WithinRelation
withinTriangle(double minX, double maxX, double minY, double maxY, double aX, double aY, boolean ab, double bX, double bY, boolean bc, double cX, double cY, boolean ca)
Compute the within relation of this component2D with a triangle-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.lucene.geo.Component2D
containsLine, containsTriangle, intersectsLine, intersectsTriangle, withinLine, withinTriangle
-
-
-
-
Field Detail
-
minY
private final double minY
minimum Y of this geometry's bounding box area
-
maxY
private final double maxY
maximum Y of this geometry's bounding box area
-
minX
private final double minX
minimum X of this geometry's bounding box area
-
maxX
private final double maxX
maximum X of this geometry's bounding box area
-
tree
private final EdgeTree tree
lines represented as a 2-d interval tree.
-
-
Method Detail
-
getMinX
public double getMinX()
Description copied from interface:Component2D
min X value for the component- Specified by:
getMinX
in interfaceComponent2D
-
getMaxX
public double getMaxX()
Description copied from interface:Component2D
max X value for the component- Specified by:
getMaxX
in interfaceComponent2D
-
getMinY
public double getMinY()
Description copied from interface:Component2D
min Y value for the component- Specified by:
getMinY
in interfaceComponent2D
-
getMaxY
public double getMaxY()
Description copied from interface:Component2D
max Y value for the component- Specified by:
getMaxY
in interfaceComponent2D
-
contains
public boolean contains(double x, double y)
Description copied from interface:Component2D
relates this component2D with a point- Specified by:
contains
in interfaceComponent2D
-
relate
public PointValues.Relation relate(double minX, double maxX, double minY, double maxY)
Description copied from interface:Component2D
relates this component2D with a bounding box- Specified by:
relate
in interfaceComponent2D
-
intersectsLine
public boolean intersectsLine(double minX, double maxX, double minY, double maxY, double aX, double aY, double bX, double bY)
Description copied from interface:Component2D
return true if this component2D intersects the provided line- Specified by:
intersectsLine
in interfaceComponent2D
-
intersectsTriangle
public boolean intersectsTriangle(double minX, double maxX, double minY, double maxY, double aX, double aY, double bX, double bY, double cX, double cY)
Description copied from interface:Component2D
return true if this component2D intersects the provided triangle- Specified by:
intersectsTriangle
in interfaceComponent2D
-
containsLine
public boolean containsLine(double minX, double maxX, double minY, double maxY, double aX, double aY, double bX, double bY)
Description copied from interface:Component2D
return true if this component2D contains the provided line- Specified by:
containsLine
in interfaceComponent2D
-
containsTriangle
public boolean containsTriangle(double minX, double maxX, double minY, double maxY, double aX, double aY, double bX, double bY, double cX, double cY)
Description copied from interface:Component2D
return true if this component2D contains the provided triangle- Specified by:
containsTriangle
in interfaceComponent2D
-
withinPoint
public Component2D.WithinRelation withinPoint(double x, double y)
Description copied from interface:Component2D
Compute the within relation of this component2D with a point- Specified by:
withinPoint
in interfaceComponent2D
-
withinLine
public Component2D.WithinRelation withinLine(double minX, double maxX, double minY, double maxY, double aX, double aY, boolean ab, double bX, double bY)
Description copied from interface:Component2D
Compute the within relation of this component2D with a line- Specified by:
withinLine
in interfaceComponent2D
-
withinTriangle
public Component2D.WithinRelation withinTriangle(double minX, double maxX, double minY, double maxY, double aX, double aY, boolean ab, double bX, double bY, boolean bc, double cX, double cY, boolean ca)
Description copied from interface:Component2D
Compute the within relation of this component2D with a triangle- Specified by:
withinTriangle
in interfaceComponent2D
-
create
static Component2D create(Line line)
create a Line2D from the provided LatLon Linestring
-
create
static Component2D create(XYLine line)
create a Line2D from the provided XY Linestring
-
-