Package org.opentrafficsim.base.geometry
Class DirectionalPolyLine
java.lang.Object
org.djutils.draw.line.PolyLine2d
org.opentrafficsim.base.geometry.OtsLine2d
org.opentrafficsim.base.geometry.DirectionalPolyLine
- All Implemented Interfaces:
Serializable
,nl.tudelft.simulation.dsol.animation.Locatable
,org.djutils.draw.Drawable<org.djutils.draw.point.Point2d>
,org.djutils.draw.Drawable2d
,org.djutils.draw.line.PolyLine<org.djutils.draw.line.PolyLine2d,
,org.djutils.draw.point.Point2d, org.djutils.draw.line.Ray2d, org.djutils.draw.line.LineSegment2d> org.djutils.draw.line.Project<org.djutils.draw.point.Point2d>
Adds a direction at the start and end point relative to its super class
OtsLine2d
, as the first and last segment may
not have the same direction as a theoretical line the segments are a numerical approach of. These directions are used in a
few methods which alter the result from the super class. The most notable addition of this class is
directionalOffsetLine
.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opentrafficsim.base.geometry.OtsLine2d
OtsLine2d.FractionalFallback
Nested classes/interfaces inherited from interface org.djutils.draw.line.PolyLine
org.djutils.draw.line.PolyLine.TransitionFunction
-
Field Summary
Fields inherited from interface org.djutils.draw.line.PolyLine
DEFAULT_CIRCLE_PRECISION, DEFAULT_OFFSET_FILTER_RATIO, DEFAULT_OFFSET_MAXIMUM_FILTER_VALUE, DEFAULT_OFFSET_MINIMUM_FILTER_VALUE, DEFAULT_OFFSET_PRECISION
-
Constructor Summary
ConstructorsConstructorDescriptionDirectionalPolyLine
(org.djutils.draw.line.PolyLine2d line, org.djunits.value.vdouble.scalar.Direction startDirection, org.djunits.value.vdouble.scalar.Direction endDirection) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiondirectionalOffsetLine
(double offset) Returns line at a fixed offset, adhering to end-point directions.directionalOffsetLine
(double startOffset, double endOffset) Returns line at a fixed offset, adhering to end-point directions.extractFractional
(double start, double end) Construct a new OtsLine2d covering the indicated fraction of this OtsLine2d.org.djunits.value.vdouble.scalar.Direction
Returns the end direction.org.djutils.draw.line.Ray2d
getLocationFraction
(double fraction) org.djunits.value.vdouble.scalar.Direction
Returns the start direction.double
projectFractional
(double x, double y, OtsLine2d.FractionalFallback fallback) Fractional projection applied with the internal start and end direction.Methods inherited from class org.opentrafficsim.base.geometry.OtsLine2d
concatenate, concatenate, concatenate, extract, extract, getCentroid, getLocation, getLocation, getLocationExtended, getLocationExtendedSI, getLocationPointFraction, getLocationPointFraction, getLocationPointFractionExtended, getLocationSI, getProjectedRadius, getProjectedVertexRadius, getTypedLength, getVertexFraction, offsetLine, offsetLine, offsetLine, projectFractional, projectOrthogonalSnap, reverse, truncate
Methods inherited from class org.djutils.draw.line.PolyLine2d
closestPointOnPolyLine, concatenate, concatenate, concatenate, equals, get, getBounds, getLength, getLocation, getLocationExtended, getPoints, getSegment, getX, getY, hashCode, instantiate, iteratorToList, lengthAtIndex, makeArray, noiseFilteredLine, offsetLine, offsetLine, projectOrthogonal, projectOrthogonalExtended, projectOrthogonalFractional, projectOrthogonalFractionalExtended, projectRay, size, toExcel, toPath2D, toPlot, toString, toString, transitionLine
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.djutils.draw.Drawable
getPointList, toString, toString
Methods inherited from interface org.djutils.draw.Drawable2d
getDimensions
Methods inherited from interface nl.tudelft.simulation.dsol.animation.Locatable
getBounds, getDirZ, getZ
Methods inherited from interface org.djutils.draw.line.PolyLine
find, getFirst, getLast, getLocationFraction, getLocationFractionExtended
-
Constructor Details
-
DirectionalPolyLine
public DirectionalPolyLine(org.djutils.draw.line.PolyLine2d line, org.djunits.value.vdouble.scalar.Direction startDirection, org.djunits.value.vdouble.scalar.Direction endDirection) Constructor.- Parameters:
line
- base linestartDirection
- start directionendDirection
- end direction
-
-
Method Details
-
directionalOffsetLine
Returns line at a fixed offset, adhering to end-point directions.- Parameters:
offset
- offset- Returns:
- offset line
-
directionalOffsetLine
Returns line at a fixed offset, adhering to end-point directions.- Parameters:
startOffset
- offset at startendOffset
- offset at end- Returns:
- offset line
-
extractFractional
Description copied from class:OtsLine2d
Construct a new OtsLine2d covering the indicated fraction of this OtsLine2d.- Specified by:
extractFractional
in interfaceorg.djutils.draw.line.PolyLine<org.djutils.draw.line.PolyLine2d,
org.djutils.draw.point.Point2d, org.djutils.draw.line.Ray2d, org.djutils.draw.line.LineSegment2d> - Overrides:
extractFractional
in classOtsLine2d
- Parameters:
start
- starting point, valid range [0..end)end
- ending point, valid range (start..1]- Returns:
- the new OtsLine2d
-
getLocationFraction
public org.djutils.draw.line.Ray2d getLocationFraction(double fraction) -
projectFractional
Fractional projection applied with the internal start and end direction.- Parameters:
x
- x-coordinatey
- y-coordinatefallback
- fallback method- Returns:
- fraction along line which it the projection of the given coordinate
-
getStartDirection
public org.djunits.value.vdouble.scalar.Direction getStartDirection()Returns the start direction.- Returns:
- start direction
-
getEndDirection
public org.djunits.value.vdouble.scalar.Direction getEndDirection()Returns the end direction.- Returns:
- end direction
-