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
Raybeing infinitely long in both directions.
Like a
Ray, it has an internalLineSegmentrepresentation with bothCoordinates 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 2Coordinates.Line(org.locationtech.jts.geom.Coordinate p0, org.locationtech.jts.geom.Coordinate p1)Line constructor with twoCoordinates.Line(org.locationtech.jts.geom.Coordinate p0, org.locationtech.jts.math.Vector2D direction)Line constructor with a baseCoordinateand a directionalVector2D.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.locationtech.jts.geom.Coordinateintersection(Line line)Intersect two infiniteLines.org.locationtech.jts.geom.Coordinateintersection(Ray ray)org.locationtech.jts.geom.Coordinateintersection(org.locationtech.jts.geom.LineSegment lineSegment)Intersect the infiniteLinewith aLineSegment.java.awt.ShapetoShape(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 twoCoordinates.- 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 baseCoordinateand 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 2Coordinates.- 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 infiniteLinewith aLineSegment.- Overrides:
intersectionin 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 infiniteLines.- Overrides:
intersectionin 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:
intersectionin 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:
toShapein interfaceShapeable- Overrides:
toShapein classRay- Parameters:
shapeWriter- writer for shapes, holds the visual boundary- Returns:
Shapeofthisline.null, if not visible.- See Also:
JTSUtils.getBoundaryIntersections(CanvasBoundary, LineSegment)
-
-