public abstract class AbstractLineSegment extends AbstractLineString implements LineSegment
| Constructor and Description |
|---|
AbstractLineSegment() |
| Modifier and Type | Method and Description |
|---|---|
double |
angle()
Computes the angle that the vector defined by this segment
makes with the X-axis.
|
AbstractLineSegment |
clone()
Creates and returns a full copy of this
LineString object. |
Point |
closestPoint(Point point)
Computes the closest point on this line segment to another point.
|
Point[] |
closestPoints(LineSegment line)
Computes the closest points on two line segments.
|
protected int |
compareTo(int index,
LineSegment other) |
int |
compareTo(Object other)
Compares this object with the specified object for order.
|
<V extends Geometry> |
convert(GeometryFactory geometryFactory)
Convert the geometry to the requried geometry factory.
|
protected LineSegment |
createLineSegment(GeometryFactory geometryFactory,
int axisCount,
double... coordinates) |
protected Point |
createPoint(GeometryFactory geometryFactory,
double... coordinates) |
double |
distance(double x,
double y) |
double |
distance(LineSegment line)
Computes the distance between this line segment and another segment.
|
double |
distance(Point point)
Computes the distance between this line segment and a given point.
|
double |
distanceAlong(double x,
double y) |
double |
distanceAlong(Point point) |
double |
distancePerpendicular(Point p)
Computes the perpendicular distance between the (infinite) line defined
by this line segment and a point.
|
boolean |
equals(LineSegment segment) |
boolean |
equals(Object o)
Returns
true if other has the same values for
its points. |
boolean |
equalsTopo(LineSegment other)
Returns
true if other is
topologically equal to this LineSegment (e.g. |
LineSegment |
extend(double startDistance,
double endDistance) |
int |
getAxisCount() |
double |
getElevation(Point point) |
LineSegment |
getIntersection(BoundingBox boundingBox) |
Geometry |
getIntersection(LineSegment lineSegment2) |
double |
getLength()
Computes the length of the line segment.
|
Point |
getP0() |
Point |
getP1() |
int |
getVertexCount()
Returns the count of this
Geometrys vertices. |
Point |
intersection(LineSegment line)
Computes an intersection point between two line segments, if there is one.
|
boolean |
intersects(Point point,
double maxDistance) |
boolean |
isEmpty()
Tests whether the set of points covered by this
Geometry is
empty. |
boolean |
isEndPoint(Point point) |
boolean |
isHorizontal()
Tests whether the segment is horizontal.
|
boolean |
isPerpendicularTo(Point point) |
boolean |
isPointOnLineMiddle(Point point,
double maxDistance) |
boolean |
isVertical()
Tests whether the segment is vertical.
|
boolean |
isWithinDistance(Point point,
double distance) |
boolean |
isZeroLength() |
Point |
lineIntersection(LineSegment line)
Computes the intersection point of the lines of infinite extent defined
by two line segments (if there is one).
|
Point |
midPoint()
Computes the midpoint of the segment
|
LineSegment |
normalize()
Puts the line segment into a normalized form.
|
int |
orientationIndex(LineSegment seg)
Determines the orientation of a LineSegment relative to this segment.
|
int |
orientationIndex(Point p)
Determines the orientation index of a
Coordinates relative to this segment. |
Point |
pointAlong(double segmentLengthFraction)
Computes the
Coordinates that lies a given
fraction along the line defined by this segment. |
Point |
pointAlongOffset(double segmentLengthFraction,
double offsetDistance)
Computes the
Coordinates that lies a given
fraction along the line defined by this segment and offset from
the segment by a given distance. |
LineSegment |
project(LineSegment seg)
Project a line segment onto this line segment and return the resulting
line segment.
|
Point |
project(Point point)
Compute the projection of a point onto the line determined
by this line segment.
|
double |
projectCoordinate(int axisIndex,
double projectionFactor) |
double |
projectionFactor(double x,
double y) |
double |
projectionFactor(Point point)
Computes the Projection Factor for the projection of the point p
onto this LineSegmentDouble.
|
LineSegment |
reverse()
Reverses the direction of the line segment.
|
double |
segmentFraction(Point inputPt)
Computes the fraction of distance (in [0.0, 1.0])
that the projection of a point occurs along this line segment.
|
boolean |
touchesEnd(LineSegment closestSegment) |
appendVertex, compareToSameClass, computeBoundingBox, convertCoordinates, copy, deleteVertex, deleteVertex, distance, doEquals, equals, equalsExact, equalsVertex, equalsVertex, equalsVertex, equalsVertex, equalsVertex, getBoundary, getBoundaryDimension, getCoordinates, getCoordinatesList, getDataType, getDimension, getEndPoint, getM, getMinVertexCount, getPoint, getPoint, getPointWithin, getSegment, getSegmentCount, getStartPoint, getToVertex, getVertex, getX, getY, getZ, hasVertex, insertVertex, intersects, isClockwise, isClosed, isCounterClockwise, isEquivalentClass, isRing, merge, merge, move, moveCoordinates, moveVertex, moveVertex, orientationIndex, points, prepare, segments, split, subLine, subLine, subLine, subLine, toClockwise, toCounterClockwise, verticesbuffer, buffer, buffer, checkNotGeometryCollection, compare, contains, containsProperly, convert, convexHull, coveredBy, covers, createVertexId, crosses, difference, disjoint, distance, envelopeCovers, envelopesIntersect, equal, equals, equals, equalsExact, equalsNorm, equalsTopo, geometries, getArea, getBoundingBox, getCentroid, getClassSortIndex, getCoordinateSystem, getEnvelope, getGeometries, getGeometries, getGeometry, getGeometryComponents, getGeometryCount, getGeometryFactory, getGeometryType, getInteriorPoint, getNonZeroGeometryFactory, getSrid, getUserData, getVertexIndex, hashCode, hasInvalidXyCoordinates, hasNonEmptyElements, hasNullElements, intersection, intersects, isAnyTargetComponentInTest, isGeometryCollection, isRectangle, isSimple, isValid, isWithinDistance, overlaps, relate, relate, setUserData, setVertexIndex, symDifference, toString, touches, toWkt, union, union, withinfinalize, getClass, notify, notifyAll, wait, wait, waitgetBoundingBox, getCoordinate, getGeometryFactorydistance, equals, equalsVertex, equalsVertex, equalsVertex, equalsVertex, equalsVertex, getCoordinates, getCoordinatesList, getEndPoint, getM, getPoint, getSegmentCount, getStartPoint, getX, getY, getZ, hasVertex, isClockwise, isClosed, isCounterClockwise, isRing, merge, merge, move, moveVertex, points, prepare, split, subLine, subLine, subLine, subLineappendVertex, buffer, buffer, buffer, compareToSameClass, contains, containsProperly, convert, convexHull, copy, coveredBy, covers, crosses, deleteVertex, difference, disjoint, distance, equal, equals, equals, equalsExact, equalsExact, equalsNorm, equalsTopo, geometries, getArea, getBoundary, getBoundaryDimension, getCentroid, getClassSortIndex, getCoordinateSystem, getDimension, getEnvelope, getGeometries, getGeometries, getGeometry, getGeometryComponents, getGeometryCount, getGeometryType, getInteriorPoint, getPoint, getPointWithin, getSegment, getSrid, getToVertex, getUserData, getVertex, hashCode, hasInvalidXyCoordinates, insertVertex, intersection, intersects, intersects, isRectangle, isSimple, isValid, isWithinDistance, moveVertex, overlaps, relate, relate, segments, setUserData, symDifference, toClockwise, toCounterClockwise, touches, toWkt, union, union, vertices, withingetDataTypepublic double angle()
angle in interface LineSegmentpublic AbstractLineSegment clone()
AbstractLineStringLineString object.
(including all coordinates contained by it).clone in interface Geometryclone in interface LineStringclone in class AbstractLineStringpublic Point closestPoint(Point point)
closestPoint in interface LineSegmentpoint - the point to find the closest point topublic Point[] closestPoints(LineSegment line)
closestPoints in interface LineSegmentline - the segment to find the closest point toprotected int compareTo(int index,
LineSegment other)
public int compareTo(Object other)
compareTo in interface GeometrycompareTo in interface Comparable<Object>compareTo in class AbstractGeometryo - the LineSegmentDouble with which this LineSegmentDouble
is being comparedLineSegmentDouble
is less than, equal to, or greater than the specified LineSegmentDoublepublic <V extends Geometry> V convert(GeometryFactory geometryFactory)
Geometryconvert in interface Geometryconvert in class AbstractGeometrygeometryFactory - The geometry factory to convert the geometry to.protected LineSegment createLineSegment(GeometryFactory geometryFactory, int axisCount, double... coordinates)
protected Point createPoint(GeometryFactory geometryFactory, double... coordinates)
public double distance(double x,
double y)
distance in interface LineSegmentpublic double distance(LineSegment line)
LineSegmentdistance in interface LineSegmentpublic double distance(Point point)
distance in interface LineSegmentpublic double distanceAlong(double x,
double y)
distanceAlong in interface LineSegmentpublic double distanceAlong(Point point)
distanceAlong in interface LineSegmentpublic double distancePerpendicular(Point p)
distancePerpendicular in interface LineSegmentpublic boolean equals(LineSegment segment)
equals in interface LineSegmentpublic boolean equals(Object o)
true if other has the same values for
its points.equals in interface Geometryequals in class AbstractGeometryo - a LineSegment with which to do the comparison.true if other is a LineSegment
with the same values for the x and y ordinates.AbstractGeometry.equals(2,Geometry),
AbstractGeometry.hashCode(),
#norm(),
AbstractGeometry.normalize()public boolean equalsTopo(LineSegment other)
true if other is
topologically equal to this LineSegment (e.g. irrespective
of orientation).equalsTopo in interface LineSegmentother - a LineSegment with which to do the comparison.true if other is a LineSegment
with the same values for the x and y ordinates in forwards or reverse order.public LineSegment extend(double startDistance, double endDistance)
public int getAxisCount()
getAxisCount in interface GeometrygetAxisCount in interface LineSegmentgetAxisCount in class AbstractGeometrypublic double getElevation(Point point)
getElevation in interface LineSegmentpublic LineSegment getIntersection(BoundingBox boundingBox)
getIntersection in interface LineSegmentpublic Geometry getIntersection(LineSegment lineSegment2)
getIntersection in interface LineSegmentpublic double getLength()
getLength in interface GeometrygetLength in class AbstractLineStringpublic Point getP0()
getP0 in interface LineSegmentpublic Point getP1()
getP1 in interface LineSegmentpublic int getVertexCount()
GeometryGeometrys vertices. The Geometry
s contained by composite Geometrys must be
Geometry's; that is, they must implement getNumPointsgetVertexCount in interface GeometryGeometrypublic Point intersection(LineSegment line)
RobustLineIntersector class should be used.intersection in interface LineSegmentline - a line segmentnull if there is noneRobustLineIntersectorpublic boolean intersects(Point point, double maxDistance)
intersects in interface LineSegmentpublic boolean isEmpty()
AbstractGeometryGeometry is
empty.isEmpty in interface GeometryisEmpty in class AbstractGeometrytrue if this Geometry does not cover any pointspublic boolean isEndPoint(Point point)
isEndPoint in interface LineSegmentpublic boolean isHorizontal()
isHorizontal in interface LineSegmenttrue if the segment is horizontalpublic boolean isPerpendicularTo(Point point)
isPerpendicularTo in interface LineSegmentpublic boolean isPointOnLineMiddle(Point point, double maxDistance)
isPointOnLineMiddle in interface LineSegmentpublic boolean isVertical()
isVertical in interface LineSegmenttrue if the segment is verticalpublic boolean isWithinDistance(Point point, double distance)
public boolean isZeroLength()
isZeroLength in interface LineSegmentpublic Point lineIntersection(LineSegment line)
RobustLineIntersector class should be used.lineIntersection in interface LineSegmentline - a line segment defining an straight line with infinite extentnull if there is no point of intersection
or an infinite number of intersection pointsRobustLineIntersectorpublic Point midPoint()
midPoint in interface LineSegmentpublic LineSegment normalize()
Coordinates).normalize in interface Geometrynormalize in interface LineStringnormalize in interface LineSegmentnormalize in class AbstractLineStringAbstractGeometry.normalize()public int orientationIndex(LineSegment seg)
orientationIndex in interface LineSegmentseg - the LineSegment to compareseg is to the left of this segmentpublic int orientationIndex(Point p)
Coordinates relative to this segment.
The orientation index is as defined in CGAlgorithms#computeOrientation.orientationIndex in interface LineSegmentp - the coordinate to comparep is to the left of this segmentCGAlgorithms#computeOrientation(Coordinate, Coordinate, Coordinate)public Point pointAlong(double segmentLengthFraction)
Coordinates that lies a given
fraction along the line defined by this segment.
A fraction of 0.0 returns the start point of the segment;
a fraction of 1.0 returns the end point of the segment.
If the fraction is < 0.0 or > 1.0 the point returned
will lie before the start or beyond the end of the segment.pointAlong in interface LineSegmentsegmentLengthFraction - the fraction of the segment length along the linepublic Point pointAlongOffset(double segmentLengthFraction, double offsetDistance)
Coordinates that lies a given
fraction along the line defined by this segment and offset from
the segment by a given distance.
A fraction of 0.0 offsets from the start point of the segment;
a fraction of 1.0 offsets from the end point of the segment.
The computed point is offset to the left of the line if the offset distance is
positive, to the right if negative.pointAlongOffset in interface LineSegmentsegmentLengthFraction - the fraction of the segment length along the lineoffsetDistance - the distance the point is offset from the segment
(positive is to the left, negative is to the right)IllegalStateException - if the segment has zero lengthpublic LineSegment project(LineSegment seg)
Note that the returned line may have zero length (i.e. the same endpoints). This can happen for instance if the lines are perpendicular to one another.
project in interface LineSegmentseg - the line segment to projectnull if there is no overlappublic Point project(Point point)
Note that the projected point may lie outside the line segment. If this is the case, the projection factor will lie outside the range [0.0, 1.0].
project in interface LineSegmentpublic double projectCoordinate(int axisIndex,
double projectionFactor)
projectCoordinate in interface LineSegmentpublic double projectionFactor(double x,
double y)
projectionFactor in interface LineSegmentpublic double projectionFactor(Point point)
The projection factor will lie in the range (-inf, +inf),
or be NaN if the line segment has zero length..
projectionFactor in interface LineSegmentp - the point to compute the factor forpublic LineSegment reverse()
reverse in interface Geometryreverse in interface LineStringreverse in interface LineSegmentreverse in class AbstractLineStringLineString with coordinates in the reverse orderpublic double segmentFraction(Point inputPt)
Essentially, this is the projectionFactor(double, double) clamped to
the range [0.0, 1.0].
If the segment has zero length, 1.0 is returned.
segmentFraction in interface LineSegmentinputPt - the pointpublic boolean touchesEnd(LineSegment closestSegment)
touchesEnd in interface LineSegmentCopyright © 2015 Revolution Systems Inc.. All rights reserved.