LineIntersector class abstract
A LineIntersector
is an algorithm that can both test whether
two line segments intersect and compute the intersection point(s)
if they do.
There are three possible outcomes when determining whether two line segments intersect:
- {@link #NO_INTERSECTION} - the segments do not intersect
- {@link #POINT_INTERSECTION} - the segments intersect in a single point
- {@link #COLLINEAR_INTERSECTION} - the segments are collinear and they intersect in a line segment
The intersection point(s) may be computed in a precise or non-precise manner. Computing an intersection point precisely involves rounding it via a supplied {@link PrecisionModel}.
LineIntersectors do not perform an initial envelope intersection test to determine if the segments are disjoint. This is because this class is likely to be used in a context where envelope overlap is already known to occur (or be likely).
@version 1.7
- Implementers
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
inputLines
↔ List<
List< Coordinate?> > -
getter/setter pair
-
intLineIndex
↔ List<
List< ?int> > -
The indexes of the endpoints of the intersection lines, in order along
the corresponding line
getter/setter pair
-
intPt
↔ List<
Coordinate> -
getter/setter pair
- pa ↔ Coordinate
-
getter/setter pair
- pb ↔ Coordinate
-
getter/setter pair
- precisionModel ↔ PrecisionModel?
-
If makePrecise is true, computed intersection coordinates will be made precise
using Coordinate#makePrecise
getter/setter pair
- result ↔ int
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
computeIntersect(
Coordinate p1, Coordinate p2, Coordinate q1, Coordinate q2) → int -
computeIntersection(
Coordinate p1, Coordinate p2, Coordinate p3, Coordinate p4) → void - Computes the intersection of the lines p1-p2 and p3-p4. This function computes both the bool value of the hasIntersection test and the (approximate) value of the intersection point itself (if there is one).
-
computeIntersectionPointLine(
Coordinate p, Coordinate p1, Coordinate p2) → void -
Compute the intersection of a point p and the line p1-p2.
This function computes the bool value of the hasIntersection test.
The actual value of the intersection (if there is one)
is equal to the value of
p
. -
computeIntLineIndex(
) → void -
computeIntLineIndexWithIndex(
int segmentIndex) → void -
getEdgeDistance(
int segmentIndex, int intIndex) → double - Computes the "edge distance" of an intersection point along the specified input line segment.
-
getEndpoint(
int segmentIndex, int ptIndex) → Coordinate? - Gets an endpoint of an input segment.
-
getIndexAlongSegment(
int segmentIndex, int intIndex) → int - Computes the index (order) of the intIndex'th intersection point in the direction of a specified input line segment
-
getIntersection(
int intIndex) → Coordinate - Returns the intIndex'th intersection point
-
getIntersectionAlongSegment(
int segmentIndex, int intIndex) → Coordinate - Computes the intIndex'th intersection point in the direction of a specified input line segment
-
getIntersectionNum(
) → int - Returns the number of intersection points found. This will be either 0, 1 or 2.
-
getTopologySummary(
) → String -
hasIntersection(
) → bool - Tests whether the input geometries intersect.
-
isCollinear(
) → bool -
isEndPoint(
) → bool -
isInteriorIntersection(
) → bool - Tests whether either intersection point is an interior point of one of the input segments.
-
isInteriorIntersectionWithIndex(
int inputLineIndex) → bool - Tests whether either intersection point is an interior point of the specified input segment.
-
isIntersection(
Coordinate pt) → bool - Test whether a point is a intersection point of two line segments. Note that if the intersection is a line segment, this method only tests for equality with the endpoints of the intersection segment. It does not return true if the input point is internal to the intersection segment.
-
isProper(
) → bool -
Tests whether an intersection is proper.
The intersection between two line segments is considered proper if they intersect in a single point in the interior of both segments (e.g. the intersection is a single point and is not equal to any of the endpoints). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setMakePrecise(
PrecisionModel precisionModel) → void -
Force computed intersection to be rounded to a given precision model
@param precisionModel
@deprecated use
setPrecisionModel
instead -
setPrecisionModel(
PrecisionModel? precisionModel) → void - Force computed intersection to be rounded to a given precision model. No getter is provided, because the precision model is not required to be specified. @param precisionModel
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- COLLINEAR → int
-
final
- COLLINEAR_INTERSECTION → int
-
Indicates that line segments intersect in a line segment
final
- DO_INTERSECT → int
-
final
- DONT_INTERSECT → int
-
These are deprecated, due to ambiguous naming
final
- NO_INTERSECTION → int
-
Indicates that line segments do not intersect
final
- POINT_INTERSECTION → int
-
Indicates that line segments intersect in a single point
final
Static Methods
-
computeEdgeDistance(
Coordinate p, Coordinate p0, Coordinate p1) → double - Computes the "edge distance" of an intersection point p along a segment. The edge distance is a metric of the point along the edge. The metric used is a robust and easy to compute metric function. It is not equivalent to the usual Euclidean metric. It relies on the fact that either the x or the y ordinates of the points in the edge are unique, depending on whether the edge is longer in the horizontal or vertical direction.
-
nonRobustComputeEdgeDistance(
Coordinate p, Coordinate p1, Coordinate p2) → double - This function is non-robust, since it may compute the square of large numbers. Currently not sure how to improve this.