class LineSegment extends Comparable[LineSegment] with Serializable
- Annotations
- @SerialVersionUID()
- Alphabetic
- By Inheritance
- LineSegment
- Serializable
- Comparable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new LineSegment()
- new LineSegment(ls: LineSegment)
- new LineSegment(x0: Double, y0: Double, x1: Double, y1: Double)
- new LineSegment(p0: Coordinate, p1: Coordinate)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def angle: Double
Computes the angle that the vector defined by this segment makes with the X-axis.
Computes the angle that the vector defined by this segment makes with the X-axis. The angle will be in the range [ -PI, PI ] radians.
return the angle this segment makes with the X-axis (in radians)
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def closestPoint(p: Coordinate): Coordinate
Computes the closest point on this line segment to another point.
Computes the closest point on this line segment to another point.
- p
the point to find the closest point to return a Coordinate which is the closest point on the line segment to the point p
- def closestPoints(line: LineSegment): Array[Coordinate]
Computes the closest points on two line segments.
Computes the closest points on two line segments.
- line
the segment to find the closest point to return a pair of Coordinates which are the closest points on the line segments
- def compareTo(other: LineSegment): Int
Compares this object with the specified object for order.
Compares this object with the specified object for order. Uses the standard lexicographic ordering for the points in the LineSegment.
- Definition Classes
- LineSegment → Comparable
- def distance(p: Coordinate): Double
Computes the distance between this line segment and a given point.
Computes the distance between this line segment and a given point.
return the distance from this segment to the given point
- def distance(ls: LineSegment): Double
Computes the distance between this line segment and another segment.
Computes the distance between this line segment and another segment.
return the distance to the other segment
- def distancePerpendicular(p: Coordinate): Double
Computes the perpendicular distance between the (infinite) line defined by this line segment and a point.
Computes the perpendicular distance between the (infinite) line defined by this line segment and a point.
return the perpendicular distance between the defined line and the given point
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(o: Any): Boolean
Returns
trueifotherhas the same values for its points.Returns
trueifotherhas the same values for its points.- o
a
LineSegmentwith which to do the comparison. returntrueifotheris aLineSegmentwith the same values for the x and y ordinates.
- Definition Classes
- LineSegment → AnyRef → Any
- def equalsTopo(other: LineSegment): Boolean
Returns
trueifotheris topologically equal to this LineSegment (e.g.Returns
trueifotheris topologically equal to this LineSegment (e.g. irrespective of orientation).- other
a
LineSegmentwith which to do the comparison. returntrueifotheris aLineSegmentwith the same values for the x and y ordinates.
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getCoordinate(i: Int): Coordinate
- def getLength: Double
Computes the length of the line segment.
Computes the length of the line segment.
return the length of the line segment
- def hashCode(): Int
Gets a hashcode for this object.
Gets a hashcode for this object.
return a hashcode for this object
- Definition Classes
- LineSegment → AnyRef → Any
- def intersection(line: LineSegment): Coordinate
Computes an intersection point between two line segments, if there is one.
Computes an intersection point between two line segments, if there is one. There may be 0, 1 or many intersection points between two segments. If there are 0, null is returned. If there is 1 or more, exactly one of them is returned (chosen at the discretion of the algorithm). If more information is required about the details of the intersection, the {link RobustLineIntersector} class should be used.
- line
a line segment return an intersection point, or
nullif there is none
- See also
RobustLineIntersector
- def isHorizontal: Boolean
Tests whether the segment is horizontal.
Tests whether the segment is horizontal.
return
trueif the segment is horizontal - final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isVertical: Boolean
Tests whether the segment is vertical.
Tests whether the segment is vertical.
return
trueif the segment is vertical - def lineIntersection(line: LineSegment): Coordinate
Computes the intersection point of the lines of infinite extent defined by two line segments (if there is one).
Computes the intersection point of the lines of infinite extent defined by two line segments (if there is one). There may be 0, 1 or an infinite number of intersection points between two lines. If there is a unique intersection point, it is returned. Otherwise, null is returned. If more information is required about the details of the intersection, the {link RobustLineIntersector} class should be used.
- line
a line segment defining an straight line with infinite extent return an intersection point, or
nullif there is no point of intersection or an infinite number of intersection points
- See also
RobustLineIntersector
- def maxX: Double
Gets the maximum X ordinate.
Gets the maximum X ordinate.
return the maximum X ordinate
- def maxY: Double
Gets the maximum Y ordinate.
Gets the maximum Y ordinate.
return the maximum Y ordinate
- def midPoint: Coordinate
Computes the midpoint of the segment
Computes the midpoint of the segment
return the midpoint of the segment
- def minX: Double
Gets the minimum X ordinate.
Gets the minimum X ordinate.
return the minimum X ordinate
- def minY: Double
Gets the minimum Y ordinate.
Gets the minimum Y ordinate.
return the minimum Y ordinate
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def normalize(): Unit
Puts the line segment into a normalized form.
Puts the line segment into a normalized form. This is useful for using line segments in maps and indexes when topological equality rather than exact equality is desired. A segment in normalized form has the first point smaller than the second (according to the standard ordering on {link Coordinate}).
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def orientationIndex(p: Coordinate): Int
Determines the orientation index of a {link Coordinate} relative to this segment.
Determines the orientation index of a {link Coordinate} relative to this segment. The orientation index is as defined in {link Orientation#computeOrientation}.
- p
the coordinate to compare return 1 (LEFT) if
pis to the left of this segment return -1 (RIGHT) ifpis to the right of this segment return 0 (COLLINEAR) ifpis collinear with this segment
- See also
Orientation#computeOrientation(Coordinate, Coordinate, Coordinate)
- def orientationIndex(seg: LineSegment): Int
Determines the orientation of a LineSegment relative to this segment.
Determines the orientation of a LineSegment relative to this segment. The concept of orientation is specified as follows: Given two line segments A and L,
- A is to the left of a segment L if A lies wholly in the closed half-plane lying to the left of L
- A is to the right of a segment L if A lies wholly in the closed half-plane lying to the right of L
- otherwise, A has indeterminate orientation relative to L. This happens if A is collinear with L or if A crosses the line determined by L.
- seg
the LineSegment to compare return 1 if
segis to the left of this segment return -1 ifsegis to the right of this segment return 0 ifsegis collinear to or crosses this segment
- var p0: Coordinate
- var p1: Coordinate
- def pointAlong(segmentLengthFraction: Double): Coordinate
Computes the {link Coordinate} that lies a given fraction along the line defined by this segment.
Computes the {link Coordinate} that lies a given fraction along the line defined by this segment. A fraction of
0.0returns the start point of the segment; a fraction of1.0returns 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 line return the point at that distance
- def pointAlongOffset(segmentLengthFraction: Double, offsetDistance: Double): Coordinate
Computes the {link Coordinate} that lies a given fraction along the line defined by this segment and offset from the segment by a given distance.
Computes the {link Coordinate} 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.0offsets from the start point of the segment; a fraction of1.0offsets 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 line
- offsetDistance
the distance the point is offset from the segment (positive is to the left, negative is to the right) return the point at that distance and offset throws IllegalStateException if the segment has zero length
- def project(seg: LineSegment): LineSegment
Project a line segment onto this line segment and return the resulting line segment.
Project a line segment onto this line segment and return the resulting line segment. The returned line segment will be a subset of the target line line segment. This subset may be null, if the segments are oriented in such a way that there is no projection.
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 project return the projected line segment, or
nullif there is no overlap
- def project(p: Coordinate): Coordinate
Compute the projection of a point onto the line determined by this line segment.
Compute the projection of a point onto the line determined by this line segment.
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].
- def projectionFactor(p: Coordinate): Double
Computes the Projection Factor for the projection of the point p onto this LineSegment.
Computes the Projection Factor for the projection of the point p onto this LineSegment. The Projection Factor is the constant r by which the vector for this segment must be multiplied to equal the vector for the projection of p on the line defined by this segment.
The projection factor will lie in the range (-inf, +inf), or be
NaNif the line segment has zero length..- p
the point to compute the factor for return the projection factor for the point
- def reflect(p: Coordinate): Coordinate
Computes the reflection of a point in the line defined by this line segment.
Computes the reflection of a point in the line defined by this line segment.
- p
the point to reflect return the reflected point
- def reverse(): Unit
Reverses the direction of the line segment.
- def segmentFraction(inputPt: Coordinate): Double
Computes the fraction of distance (in [0.0, 1.0]) that the projection of a point occurs along this line segment.
Computes the fraction of distance (in [0.0, 1.0]) that the projection of a point occurs along this line segment. If the point is beyond either ends of the line segment, the closest fractional value (0.0 or 1.0) is returned.
Essentially, this is the {link #projectionFactor} clamped to the range [0.0, 1.0]. If the segment has zero length, 1.0 is returned.
- inputPt
the point return the fraction along the line segment the projection of the point occurs
- def setCoordinates(p0: Coordinate, p1: Coordinate): Unit
- def setCoordinates(ls: LineSegment): Unit
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toGeometry(geomFactory: GeometryFactory): LineString
Creates a LineString with the same coordinates as this segment
Creates a LineString with the same coordinates as this segment
- geomFactory
the geometry factory to use return a LineString with the same geometry as this segment
- def toString(): String
- Definition Classes
- LineSegment → AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()