Class FastLineIntersector

java.lang.Object
org.locationtech.jts.algorithm.LineIntersector
com.github.micycle1.geoblitz.FastLineIntersector

public class FastLineIntersector extends org.locationtech.jts.algorithm.LineIntersector
Fast, pragmatic line segment intersection implementation optimized for speed.

This implementation is similar to RobustLineIntersector but sacrifices some of the extreme numerical robustness techniques used there (for example, double-double arithmetic and determinant exactness) in favor of performance.

Important notes and trade-offs:

  • Speed over ultimate robustness — this class is appropriate when performance is the priority and occasional, extremely ill-conditioned corner cases can be tolerated or handled at a higher level.
  • Uses a fast orientation test (with a small relative epsilon check) and only falls back to RobustDeterminant.signOfDet2x2(double, double, double, double) in borderline cases.
  • No special Z interpolation is performed (the implementation returns copies of input coordinates for collinear overlaps and endpoints).
  • A precisionModel (inherited from LineIntersector) is applied to computed intersection points if present.
  • The instance is stateful (it records input lines, intersection points, and flags such as isProper) and therefore is not thread-safe for concurrent use. Create a separate instance per thread or call site if concurrent access is required.
Author:
Michael Carleton
  • Field Summary

    Fields inherited from class org.locationtech.jts.algorithm.LineIntersector

    COLLINEAR, COLLINEAR_INTERSECTION, DO_INTERSECT, DONT_INTERSECT, inputLines, intLineIndex, intPt, isProper, NO_INTERSECTION, pa, pb, POINT_INTERSECTION, precisionModel, result
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected int
    computeIntersect(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p2, org.locationtech.jts.geom.Coordinate q1, org.locationtech.jts.geom.Coordinate q2)
     
    void
    computeIntersection(org.locationtech.jts.geom.Coordinate p, org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p2)
     

    Methods inherited from class org.locationtech.jts.algorithm.LineIntersector

    computeEdgeDistance, computeIntersection, computeIntLineIndex, computeIntLineIndex, getEdgeDistance, getEndpoint, getIndexAlongSegment, getIntersection, getIntersectionAlongSegment, getIntersectionNum, hasIntersection, isCollinear, isEndPoint, isInteriorIntersection, isInteriorIntersection, isIntersection, isProper, nonRobustComputeEdgeDistance, setMakePrecise, setPrecisionModel, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • FastLineIntersector

      public FastLineIntersector()
  • Method Details

    • computeIntersection

      public void computeIntersection(org.locationtech.jts.geom.Coordinate p, org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p2)
      Specified by:
      computeIntersection in class org.locationtech.jts.algorithm.LineIntersector
    • computeIntersect

      protected int computeIntersect(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p2, org.locationtech.jts.geom.Coordinate q1, org.locationtech.jts.geom.Coordinate q2)
      Specified by:
      computeIntersect in class org.locationtech.jts.algorithm.LineIntersector