Package org.djutils.draw.line
Interface LineSegment<P extends Point<P>,R extends Ray<R,P>>
- 
- Type Parameters:
- P- The point type (2d or 3d)
- R- The ray type (2d or 3d)
 - All Superinterfaces:
- Drawable<P>,- Project<P>,- Serializable
 - All Known Implementing Classes:
- LineSegment2d,- LineSegment3d
 
 public interface LineSegment<P extends Point<P>,R extends Ray<R,P>> extends Drawable<P>, Serializable, Project<P> LineSegment is the interface for a line segment bound by 2 end points. A line segment stores the order in which it has been created, so the end points are known as 'start' and 'end'.Copyright (c) 2020-2021 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. 
 BSD-style license. See DJUTILS License.- Author:
- Alexander Verbraeck, Peter Knoppers
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description PclosestPointOnSegment(P point)Project a Point on this LineSegment.PgetEndPoint()Get the end point of this LineSegment.doublegetLength()Get the length (distance from start point to end point) of this LineSegment.default RgetLocation(double position)Create a Ray on a specified point on this LineSegment.RgetLocationExtended(double position)Create a Ray on a specified point on this LineSegment.PgetStartPoint()Get the start point of this LineSegment.StringtoExcel()Convert this PolyLine to something that MS-Excel can plot.- 
Methods inherited from interface org.djutils.draw.DrawablegetDimensions, getPoints, size, toString, toString, toString, toString
 - 
Methods inherited from interface org.djutils.draw.line.ProjectprojectOrthogonal, projectOrthogonalExtended, projectOrthogonalFractional, projectOrthogonalFractionalExtended
 
- 
 
- 
- 
- 
Method Detail- 
getStartPointP getStartPoint() Get the start point of this LineSegment.- Returns:
- P; the start point of the LineSegment
 
 - 
getEndPointP getEndPoint() Get the end point of this LineSegment.- Returns:
- P; the end point of the LineSegment
 
 - 
getLengthdouble getLength() Get the length (distance from start point to end point) of this LineSegment.- Returns:
- double; (distance from start point to end point) of this LineSegment
 
 - 
closestPointOnSegmentP closestPointOnSegment(P point) throws NullPointerException Project a Point on this LineSegment. If the the projected points lies outside the line segment, the nearest end point of the line segment is returned. Otherwise the returned point lies between the end points of the line segment.
 Adapted from example code provided by Paul Bourke.- Parameters:
- point- P; the point to project onto the segment
- Returns:
- P; either the start point, or the end point of the segment or a Point that lies somewhere in between those two.
- Throws:
- NullPointerException- when point is null
 
 - 
getLocationdefault R getLocation(double position) throws DrawRuntimeException Create a Ray on a specified point on this LineSegment.- Parameters:
- position- double; the distance from the start point of this LineSegment.
- Returns:
- R; a ray beginning at the specified position
- Throws:
- DrawRuntimeException- when position is NaN, < 0 or > length of this LineSegment
 
 - 
getLocationExtendedR getLocationExtended(double position) throws DrawRuntimeException Create a Ray on a specified point on this LineSegment.- Parameters:
- position- double; the distance from the start point of this LineSegment.
- Returns:
- R; a ray beginning at the specified position
- Throws:
- DrawRuntimeException- when position is NaN or infinite
 
 - 
toExcelString toExcel() Convert this PolyLine to something that MS-Excel can plot.- Returns:
- String MS-excel XY, or XYZ plottable output
 
 
- 
 
-