com.vividsolutions.jump.geom
Class LineSegmentUtil

java.lang.Object
  extended by com.vividsolutions.jump.geom.LineSegmentUtil

public class LineSegmentUtil
extends java.lang.Object

Utility functions for LineSegments.

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


Constructor Summary
LineSegmentUtil()
           
 
Method Summary
static com.vividsolutions.jts.geom.LineString asGeometry(com.vividsolutions.jts.geom.GeometryFactory factory, com.vividsolutions.jts.geom.LineSegment seg)
          Converts a LineSegment to a LineString.
static double hausdorffDistance(com.vividsolutions.jts.geom.LineSegment seg0, com.vividsolutions.jts.geom.LineSegment seg1)
          Computes the Hausdorff distance between two LineSegments.
static com.vividsolutions.jts.geom.LineSegment project(com.vividsolutions.jts.geom.LineSegment tgt, com.vividsolutions.jts.geom.LineSegment seg)
          Projects one line segment onto another and returns the resulting line segment.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineSegmentUtil

public LineSegmentUtil()
Method Detail

project

public static com.vividsolutions.jts.geom.LineSegment project(com.vividsolutions.jts.geom.LineSegment tgt,
                                                              com.vividsolutions.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(com.vividsolutions.jts.geom.LineSegment seg0,
                                       com.vividsolutions.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 com.vividsolutions.jts.geom.LineString asGeometry(com.vividsolutions.jts.geom.GeometryFactory factory,
                                                                com.vividsolutions.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