Class Line

  • All Implemented Interfaces:
    Shapeable, java.io.Serializable, java.lang.Comparable
    Direct Known Subclasses:
    HalfPlane

    public class Line
    extends Ray

    The line is an extension of a Ray being infinitely long in both directions.


    Like a Ray, it has an internal LineSegment representation with both Coordinates being points in the line one length-unit separated.

    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class org.locationtech.jts.geom.LineSegment

        p0, p1
    • Constructor Summary

      Constructors 
      Constructor Description
      Line​(double x1, double y1, double x2, double y2)
      Line constructor using 4 doubles forming 2 Coordinates.
      Line​(org.locationtech.jts.geom.Coordinate p0, org.locationtech.jts.geom.Coordinate p1)
      Line constructor with two Coordinates.
      Line​(org.locationtech.jts.geom.Coordinate p0, org.locationtech.jts.math.Vector2D direction)
      Line constructor with a base Coordinate and a directional Vector2D.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.locationtech.jts.geom.Coordinate intersection​(Line line)
      Intersect two infinite Lines.
      org.locationtech.jts.geom.Coordinate intersection​(Ray ray)
      Intersects a infinite Line with a Ray.
      org.locationtech.jts.geom.Coordinate intersection​(org.locationtech.jts.geom.LineSegment lineSegment)
      Intersect the infinite Line with a LineSegment.
      java.awt.Shape toShape​(AdvancedShapeWriter shapeWriter)
      Convert the infinite line to a line shape, if it lays inside of the visual boundary.
      • Methods inherited from class org.locationtech.jts.geom.LineSegment

        angle, closestPoint, closestPoints, compareTo, distance, distance, distancePerpendicular, equals, equalsTopo, getCoordinate, hashCode, isHorizontal, isVertical, lineIntersection, maxX, maxY, midPoint, midPoint, minX, minY, normalize, orientationIndex, orientationIndex, pointAlong, pointAlongOffset, project, project, projectionFactor, reverse, segmentFraction, setCoordinates, setCoordinates, toGeometry, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Line

        public Line​(org.locationtech.jts.geom.Coordinate p0,
                    org.locationtech.jts.geom.Coordinate p1)
        Line constructor with two Coordinates.
        Parameters:
        p0 - first coordinate defining the line
        p1 - second coordinate defining the line
      • Line

        public Line​(org.locationtech.jts.geom.Coordinate p0,
                    org.locationtech.jts.math.Vector2D direction)
        Line constructor with a base Coordinate and a directional Vector2D.
        Parameters:
        p0 - base point
        direction - direction vector
      • Line

        public Line​(double x1,
                    double y1,
                    double x2,
                    double y2)
        Line constructor using 4 doubles forming 2 Coordinates.
        Parameters:
        x1 - x-coordinate of first coordinate
        y1 - y-coordinate of first coordinate
        x2 - x-coordinate of second coordinate
        y2 - y-coordinate of second coordinate
    • Method Detail

      • intersection

        public org.locationtech.jts.geom.Coordinate intersection​(org.locationtech.jts.geom.LineSegment lineSegment)
        Intersect the infinite Line with a LineSegment.
        Overrides:
        intersection in class Ray
        Parameters:
        lineSegment - segment to intersect ray with
        Returns:
        intersection between infinite line and segment, if there is none: null
      • intersection

        public org.locationtech.jts.geom.Coordinate intersection​(Line line)
        Intersect two infinite Lines.
        Overrides:
        intersection in class Ray
        Parameters:
        line - infinite line to intersect this infinite line with
        Returns:
        intersection between two infinite lines, if there is none: null
      • intersection

        public org.locationtech.jts.geom.Coordinate intersection​(Ray ray)
        Intersects a infinite Line with a Ray.
        Overrides:
        intersection in class Ray
        Parameters:
        ray - ray to intersect this infinite line with
        Returns:
        intersection between infinite line and ray, if there is none: null
        See Also:
        Ray.intersection(Line)