Package com.treasure.hunt.jts.geom
Class Line
- java.lang.Object
-
- org.locationtech.jts.geom.LineSegment
-
- com.treasure.hunt.jts.geom.Ray
-
- com.treasure.hunt.jts.geom.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 internalLineSegment
representation with bothCoordinate
s being points in the line one length-unit separated.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Line(double x1, double y1, double x2, double y2)
Line constructor using 4 doubles forming 2Coordinate
s.Line(org.locationtech.jts.geom.Coordinate p0, org.locationtech.jts.geom.Coordinate p1)
Line constructor with twoCoordinate
s.Line(org.locationtech.jts.geom.Coordinate p0, org.locationtech.jts.math.Vector2D direction)
Line constructor with a baseCoordinate
and a directionalVector2D
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.locationtech.jts.geom.Coordinate
intersection(Line line)
Intersect two infiniteLine
s.org.locationtech.jts.geom.Coordinate
intersection(Ray ray)
org.locationtech.jts.geom.Coordinate
intersection(org.locationtech.jts.geom.LineSegment lineSegment)
Intersect the infiniteLine
with aLineSegment
.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 com.treasure.hunt.jts.geom.Ray
getDirection, getLength, inLine, inRay, inSegment, intersects
-
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
-
-
-
-
Constructor Detail
-
Line
public Line(org.locationtech.jts.geom.Coordinate p0, org.locationtech.jts.geom.Coordinate p1)
Line constructor with twoCoordinate
s.- Parameters:
p0
- first coordinate defining the linep1
- second coordinate defining the line
-
Line
public Line(org.locationtech.jts.geom.Coordinate p0, org.locationtech.jts.math.Vector2D direction)
Line constructor with a baseCoordinate
and a directionalVector2D
.- Parameters:
p0
- base pointdirection
- direction vector
-
Line
public Line(double x1, double y1, double x2, double y2)
Line constructor using 4 doubles forming 2Coordinate
s.- Parameters:
x1
- x-coordinate of first coordinatey1
- y-coordinate of first coordinatex2
- x-coordinate of second coordinatey2
- y-coordinate of second coordinate
-
-
Method Detail
-
intersection
public org.locationtech.jts.geom.Coordinate intersection(org.locationtech.jts.geom.LineSegment lineSegment)
Intersect the infiniteLine
with aLineSegment
.- Overrides:
intersection
in classRay
- 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 infiniteLine
s.- Overrides:
intersection
in classRay
- 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)
- Overrides:
intersection
in classRay
- 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)
-
toShape
public java.awt.Shape toShape(AdvancedShapeWriter shapeWriter)
Convert the infinite line to a line shape, if it lays inside of the visual boundary.- Specified by:
toShape
in interfaceShapeable
- Overrides:
toShape
in classRay
- Parameters:
shapeWriter
- writer for shapes, holds the visual boundary- Returns:
Shape
ofthis
line.null
, if not visible.- See Also:
JTSUtils.getBoundaryIntersections(CanvasBoundary, LineSegment)
-
-