Package org.opentrafficsim.core.geometry
Class ContinuousClothoid
java.lang.Object
org.opentrafficsim.core.geometry.ContinuousClothoid
- All Implemented Interfaces:
ContinuousLine
Continuous definition of a clothoid. The following definitions are available:
- A clothoid between two directed points.
- A clothoid originating from a directed point with start curvature, end curvature, and length specified.
- A clothoid originating from a directed point with start curvature, end curvature, and A-value specified.
- Dale Connor and Lilia Krivodonova (2014) "Interpolation of two-dimensional curves with Euler spirals", Journal of Computational and Applied Mathematics, Volume 261, 1 May 2014, pp. 320-332.
- D.J. Waltona and D.S. Meek (2009) "G1 interpolation with a single Cornu spiral segment", Journal of Computational and Applied Mathematics, Volume 223, Issue 1, 1 January 2009, pp. 86-96.
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.
-
Constructor Summary
ConstructorDescriptionContinuousClothoid
(org.djutils.draw.point.OrientedPoint2d startPoint, double a, double startCurvature, double endCurvature) Create clothoid from one point based on curvature and A-value.ContinuousClothoid
(org.djutils.draw.point.OrientedPoint2d startPoint, org.djutils.draw.point.OrientedPoint2d endPoint) Create clothoid between two directed points. -
Method Summary
Modifier and TypeMethodDescriptionorg.djutils.draw.line.PolyLine2d
Flatten continuous line in to a polyline.org.djutils.draw.line.PolyLine2d
flattenOffset
(FractionalLengthData offsets, Flattener flattener) Flatten continuous line offset in to a polyline.double
getA()
Return A, the clothoid scaling parameter.Returns whether the shape was applied as a Clothoid, an Arc, or as a Straight, depending on start and end position and direction.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.toString()
static ContinuousClothoid
withLength
(org.djutils.draw.point.OrientedPoint2d startPoint, double length, double startCurvature, double endCurvature) Create clothoid from one point based on curvature and length.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
-
ContinuousClothoid
public ContinuousClothoid(org.djutils.draw.point.OrientedPoint2d startPoint, org.djutils.draw.point.OrientedPoint2d endPoint) Create clothoid between two directed points. This constructor is based on the procedure in:
Dale Connor and Lilia Krivodonova (2014) "Interpolation of two-dimensional curves with Euler spirals", Journal of Computational and Applied Mathematics, Volume 261, 1 May 2014, pp. 320-332.
Which applies the theory proven in:
D.J. Waltona and D.S. Meek (2009) "G1 interpolation with a single Cornu spiral segment", Journal of Computational and Applied Mathematics, Volume 223, Issue 1, 1 January 2009, pp. 86-96.
This procedure guarantees that the resulting line has the minimal angle rotation that is required to connect the points. If the points approximate a straight line or circle, with a tolerance of up 1/10th of a degree, those respective lines are created. The numerical approximation of the underlying Fresnal integral is different from the paper. SeeClothoid.fresnal()
.- Parameters:
startPoint
- OrientedPoint2d; start point.endPoint
- OrientedPoint2d; end point.- See Also:
-
ContinuousClothoid
public ContinuousClothoid(org.djutils.draw.point.OrientedPoint2d startPoint, double a, double startCurvature, double endCurvature) Create clothoid from one point based on curvature and A-value.- Parameters:
startPoint
- OrientedPoint2d; start point.a
- Length; A-value.startCurvature
- double; start curvature.endCurvature
- double; end curvature;
-
-
Method Details
-
withLength
public static ContinuousClothoid withLength(org.djutils.draw.point.OrientedPoint2d startPoint, double length, double startCurvature, double endCurvature) Create clothoid from one point based on curvature and length. This method calculates the A-value as sqrt(L/|k2-k1|), where L is the length of the resulting clothoid, and k2 and k1 are the end and start curvature.- Parameters:
startPoint
- OrientedPoint2d; start point.length
- double; Length of the resulting clothoid.startCurvature
- double; start curvature.endCurvature
- double; end curvature;- Returns:
- ContinuousClothoid; clothoid based on curvature and length.
-
getStartPoint
public org.djutils.draw.point.OrientedPoint2d getStartPoint()Start point.- Specified by:
getStartPoint
in interfaceContinuousLine
- Returns:
- OrientedPoint2d; start point.
-
getEndPoint
public org.djutils.draw.point.OrientedPoint2d getEndPoint()End point.- Specified by:
getEndPoint
in interfaceContinuousLine
- Returns:
- OrientedPoint2d; end point.
-
getStartCurvature
public double getStartCurvature()Start curvature.- Specified by:
getStartCurvature
in interfaceContinuousLine
- Returns:
- double; start curvature.
-
getEndCurvature
public double getEndCurvature()End curvature.- Specified by:
getEndCurvature
in interfaceContinuousLine
- Returns:
- double; end curvature.
-
getStartRadius
public double getStartRadius()Start radius.- Specified by:
getStartRadius
in interfaceContinuousLine
- Returns:
- double; start radius.
-
getEndRadius
public double getEndRadius()End radius.- Specified by:
getEndRadius
in interfaceContinuousLine
- Returns:
- double; end radius.
-
getA
public double getA()Return A, the clothoid scaling parameter.- Returns:
- double; a, the clothoid scaling parameter.
-
flatten
Flatten continuous line in to a polyline. Implementations should use the flattener when relevant and possible.- Specified by:
flatten
in interfaceContinuousLine
- Parameters:
flattener
- Flattener; flattener.- Returns:
- PolyLine2d; flattened line.
-
flattenOffset
public org.djutils.draw.line.PolyLine2d flattenOffset(FractionalLengthData offsets, Flattener flattener) Flatten continuous line offset in to a polyline. Implementations should use the flattener when relevant and possible.- Specified by:
flattenOffset
in interfaceContinuousLine
- Parameters:
offsets
- FractionalLengthData; offset data.flattener
- Flattener; flattener.- Returns:
- PolyLine2d; flattened line.
-
getLength
public double getLength()Return the length of the line.- Specified by:
getLength
in interfaceContinuousLine
- Returns:
- double; length of the line.
-
getAppliedShape
Returns whether the shape was applied as a Clothoid, an Arc, or as a Straight, depending on start and end position and direction.- Returns:
- String; "Clothoid", "Arc" or "Straight".
-
toString
-