Class LineSegmentUtil


  • public class LineSegmentUtil
    extends Object
    Utility functions for LineSegments.

    Note: Eventually some of these functions may be moved into the JTS LineSegment class.

    • Constructor Summary

      Constructors 
      Constructor Description
      LineSegmentUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.locationtech.jts.geom.LineString asGeometry​(org.locationtech.jts.geom.GeometryFactory factory, org.locationtech.jts.geom.LineSegment seg)
      Converts a LineSegment to a LineString.
      static double hausdorffDistance​(org.locationtech.jts.geom.LineSegment seg0, org.locationtech.jts.geom.LineSegment seg1)
      Computes the Hausdorff distance between two LineSegments.
      static org.locationtech.jts.geom.LineSegment project​(org.locationtech.jts.geom.LineSegment tgt, org.locationtech.jts.geom.LineSegment seg)
      Projects one line segment onto another and returns the resulting line segment.
    • Constructor Detail

      • LineSegmentUtil

        public LineSegmentUtil()
    • Method Detail

      • project

        public static org.locationtech.jts.geom.LineSegment project​(org.locationtech.jts.geom.LineSegment tgt,
                                                                    org.locationtech.jts.geom.LineSegment seg)
        Projects one line segment onto another and returns the resulting line segment. The returned line segment will be a subset of the target line line segment. This subset may be null, if the segments are oriented in such a way that there is no projection.
        Parameters:
        tgt - the line segment to be projected onto
        seg - the line segment to project
        Returns:
        the projected line segment, or null if there is no overlap
      • hausdorffDistance

        public static double hausdorffDistance​(org.locationtech.jts.geom.LineSegment seg0,
                                               org.locationtech.jts.geom.LineSegment seg1)
        Computes the Hausdorff distance between two LineSegments. To compute the Hausdorff distance, it is sufficient to compute the distance from one segment's endpoints to the other segment and choose the maximum.
        Parameters:
        seg0 -
        seg1 -
        Returns:
        the Hausdorff distance between the segments
      • asGeometry

        public static org.locationtech.jts.geom.LineString asGeometry​(org.locationtech.jts.geom.GeometryFactory factory,
                                                                      org.locationtech.jts.geom.LineSegment seg)
        Converts a LineSegment to a LineString.
        Parameters:
        factory - a factory used to create the LineString
        seg - the LineSegment to convert
        Returns:
        a new LineString based on the segment