Package org.opentrafficsim.core.geometry
Class ContinuousPolyLine
java.lang.Object
org.opentrafficsim.core.geometry.ContinuousPolyLine
- All Implemented Interfaces:
ContinuousLine
Continuous definition of a PolyLine. Naive approaches are applied for offsets, since polylines have no exact information for
this.
Copyright (c) 2023-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Wouter Schakel
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opentrafficsim.core.geometry.ContinuousLine
ContinuousLine.ContinuousDoubleFunction
-
Constructor Summary
ConstructorsConstructorDescriptionContinuousPolyLine
(org.djutils.draw.line.PolyLine2d line) Define continuous line from polyline.ContinuousPolyLine
(org.djutils.draw.line.PolyLine2d line, org.djutils.draw.point.OrientedPoint2d startPoint, org.djutils.draw.point.OrientedPoint2d endPoint) Define continuous line from polyline. -
Method Summary
Modifier and TypeMethodDescriptionorg.djutils.draw.line.PolyLine2d
flatten()
Polyline from continuous line.org.djutils.draw.line.PolyLine2d
Returns the line as is.org.djutils.draw.line.PolyLine2d
flattenOffset
(ContinuousLine.ContinuousDoubleFunction offset, Flattener flattener) Returns the regular offset.double
End curvature.org.djutils.draw.point.OrientedPoint2d
End point.double
End radius.double
Return the length of the line.double
Start curvature.org.djutils.draw.point.OrientedPoint2d
Start point.double
Start radius.org.djutils.draw.line.PolyLine2d
Returns an offset line.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opentrafficsim.core.geometry.ContinuousLine
getEndDirection, getStartDirection
-
Constructor Details
-
ContinuousPolyLine
public ContinuousPolyLine(org.djutils.draw.line.PolyLine2d line) Define continuous line from polyline. Start and end point direction are derived from the line.- Parameters:
line
- line.
-
ContinuousPolyLine
public ContinuousPolyLine(org.djutils.draw.line.PolyLine2d line, org.djutils.draw.point.OrientedPoint2d startPoint, org.djutils.draw.point.OrientedPoint2d endPoint) Define continuous line from polyline. Start and end point are given and may alter the direction at the endpoints (slightly).- Parameters:
line
- line.startPoint
- start point.endPoint
- end point.
-
-
Method Details
-
getStartPoint
public org.djutils.draw.point.OrientedPoint2d getStartPoint()Description copied from interface:ContinuousLine
Start point.- Specified by:
getStartPoint
in interfaceContinuousLine
- Returns:
- start point
-
getEndPoint
public org.djutils.draw.point.OrientedPoint2d getEndPoint()Description copied from interface:ContinuousLine
End point.- Specified by:
getEndPoint
in interfaceContinuousLine
- Returns:
- end point
-
getStartCurvature
public double getStartCurvature()Description copied from interface:ContinuousLine
Start curvature.- Specified by:
getStartCurvature
in interfaceContinuousLine
- Returns:
- start curvature
-
getEndCurvature
public double getEndCurvature()Description copied from interface:ContinuousLine
End curvature.- Specified by:
getEndCurvature
in interfaceContinuousLine
- Returns:
- end curvature
-
getStartRadius
public double getStartRadius()Description copied from interface:ContinuousLine
Start radius.- Specified by:
getStartRadius
in interfaceContinuousLine
- Returns:
- start radius
-
getEndRadius
public double getEndRadius()Description copied from interface:ContinuousLine
End radius.- Specified by:
getEndRadius
in interfaceContinuousLine
- Returns:
- end radius
-
flatten
public org.djutils.draw.line.PolyLine2d flatten()Polyline from continuous line. Returns the line as is.- Returns:
- polyline.
-
flatten
Returns the line as is. Flattener is ignored.- Specified by:
flatten
in interfaceContinuousLine
- Parameters:
flattener
- flattener (ignored).- Returns:
- flattened line.
-
offset
Returns an offset line. This is a regular offset line, with start and end points moved to be perpendicular to end point directions.- Parameters:
offset
- offset data.- Returns:
- flattened line.
-
flattenOffset
public org.djutils.draw.line.PolyLine2d flattenOffset(ContinuousLine.ContinuousDoubleFunction offset, Flattener flattener) Returns the regular offset. Flattener is ignored.- Specified by:
flattenOffset
in interfaceContinuousLine
- Parameters:
offset
- offset data.flattener
- flattener (ignored).- Returns:
- flattened line.
-
getLength
public double getLength()Description copied from interface:ContinuousLine
Return the length of the line.- Specified by:
getLength
in interfaceContinuousLine
- Returns:
- length of the line
-
toString
-