public interface LineSegment extends LineString
| Modifier and Type | Method and Description |
|---|---|
double |
angle()
Computes the angle that the vector defined by this segment
makes with the X-axis.
|
Point |
closestPoint(Point p)
Computes the closest point on this line segment to another point.
|
Point[] |
closestPoints(LineSegment line)
Computes the closest points on two line segments.
|
double |
distance(double x,
double y) |
double |
distance(LineSegment ls)
Computes the distance between this line segment and another segment.
|
double |
distance(Point p)
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 |
equalsTopo(LineSegment other)
Returns
true if other is
topologically equal to this LineSegment (e.g. |
int |
getAxisCount() |
BoundingBox |
getBoundingBox()
Gets an
BoundingBoxDoubleGf containing
the minimum and maximum x and y values in this Geometry. |
double |
getCoordinate(int vertexIndex,
int axisIndex) |
double |
getElevation(Point point) |
GeometryFactory |
getGeometryFactory()
Gets the geometryFactory which contains the context in which this geometry was created.
|
LineSegment |
getIntersection(BoundingBox boundingBox) |
Geometry |
getIntersection(LineSegment lineSegment2) |
Point |
getP0() |
Point |
getP1() |
Point |
intersection(LineSegment line)
Computes an intersection point between two line segments, if there is one.
|
boolean |
intersects(Point point,
double maxDistance) |
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 |
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 p)
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 p)
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 point)
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) |
clone, distance, 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, compareTo, compareToSameClass, contains, containsProperly, convert, convert, convexHull, copy, coveredBy, covers, crosses, deleteVertex, difference, disjoint, distance, equal, equals, equals, equals, equalsExact, equalsExact, equalsNorm, equalsTopo, geometries, getArea, getBoundary, getBoundaryDimension, getCentroid, getClassSortIndex, getCoordinateSystem, getDimension, getEnvelope, getGeometries, getGeometries, getGeometry, getGeometryComponents, getGeometryCount, getGeometryType, getInteriorPoint, getLength, getPoint, getPointWithin, getSegment, getSrid, getToVertex, getUserData, getVertex, getVertexCount, hashCode, hasInvalidXyCoordinates, insertVertex, intersection, intersects, intersects, isEmpty, isRectangle, isSimple, isValid, isWithinDistance, moveVertex, overlaps, relate, relate, segments, setUserData, symDifference, toClockwise, toCounterClockwise, touches, toWkt, union, union, vertices, withingetDataTypedouble angle()
Point closestPoint(Point p)
p - the point to find the closest point toPoint[] closestPoints(LineSegment line)
line - the segment to find the closest point todouble distance(double x,
double y)
double distance(LineSegment ls)
double distance(Point p)
double distanceAlong(double x,
double y)
double distanceAlong(Point point)
double distancePerpendicular(Point p)
boolean equals(LineSegment segment)
boolean equalsTopo(LineSegment other)
true if other is
topologically equal to this LineSegment (e.g. irrespective
of orientation).other - a LineSegmentDouble with which to do the comparison.true if other is a LineSegmentDouble
with the same values for the x and y ordinates.int getAxisCount()
getAxisCount in interface GeometryBoundingBox getBoundingBox()
GeometryBoundingBoxDoubleGf containing
the minimum and maximum x and y values in this Geometry.
If the geometry is empty, an empty BoundingBoxDoubleGf
is returned.
The returned object is a copy of the one maintained internally, to avoid aliasing issues. For best performance, clients which access this envelope frequently should cache the return value.
getBoundingBox in interface GeometryGeometry.double getCoordinate(int vertexIndex,
int axisIndex)
getCoordinate in interface LineStringdouble getElevation(Point point)
GeometryFactory getGeometryFactory()
GeometrygetGeometryFactory in interface GeometryLineSegment getIntersection(BoundingBox boundingBox)
Geometry getIntersection(LineSegment lineSegment2)
Point getP0()
Point getP1()
Point intersection(LineSegment line)
RobustLineIntersector class should be used.line - a line segmentnull if there is noneRobustLineIntersectorboolean intersects(Point point, double maxDistance)
boolean isEndPoint(Point point)
boolean isHorizontal()
true if the segment is horizontalboolean isPerpendicularTo(Point point)
boolean isPointOnLineMiddle(Point point, double maxDistance)
boolean isVertical()
true if the segment is verticalboolean isZeroLength()
Point lineIntersection(LineSegment line)
RobustLineIntersector class should be used.line - a line segment defining an straight line with infinite extentnull if there is no point of intersection
or an infinite number of intersection pointsRobustLineIntersectorPoint midPoint()
LineSegment normalize()
Coordinates).normalize in interface Geometrynormalize in interface LineStringGeometry.normalize()int orientationIndex(LineSegment seg)
seg - the LineSegment to compareseg is to the left of this segmentint orientationIndex(Point p)
Coordinates relative to this segment.
The orientation index is as defined in CGAlgorithms#computeOrientation.p - the coordinate to comparep is to the left of this segmentCGAlgorithms#computeOrientation(Coordinate, Coordinate, Coordinate)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.segmentLengthFraction - the fraction of the segment length along the linePoint 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.segmentLengthFraction - 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 lengthLineSegment 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.
seg - the line segment to projectnull if there is no overlapPoint project(Point p)
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].
double projectCoordinate(int axisIndex,
double projectionFactor)
double projectionFactor(double x,
double y)
double projectionFactor(Point p)
The projection factor will lie in the range (-inf, +inf),
or be NaN if the line segment has zero length..
p - the point to compute the factor forLineSegment reverse()
reverse in interface Geometryreverse in interface LineStringdouble segmentFraction(Point point)
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.
point - the pointboolean touchesEnd(LineSegment closestSegment)
Copyright © 2015 Revolution Systems Inc.. All rights reserved.