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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opentrafficsim.core.geometry.ContinuousLine
ContinuousLine.ContinuousDoubleFunction -
Constructor Summary
ConstructorsConstructorDescriptionContinuousClothoid(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.PolyLine2dFlatten continuous line in to a polyline.org.djutils.draw.line.PolyLine2dflattenOffset(ContinuousLine.ContinuousDoubleFunction offset, Flattener flattener) Flatten continuous line offset in to a polyline.doublegetA()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.doubleEnd curvature.org.djutils.draw.point.OrientedPoint2dEnd point.doubleEnd radius.doubleReturn the length of the line.doubleStart curvature.org.djutils.draw.point.OrientedPoint2dStart point.doubleStart radius.toString()static ContinuousClothoidwithLength(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, waitMethods 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 Fresnel integral is different from the paper. SeeClothoid.fresnal().- Parameters:
startPoint- start point.endPoint- 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- start point.a- A-value.startCurvature- start curvature.endCurvature- 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- start point.length- Length of the resulting clothoid.startCurvature- start curvature.endCurvature- end curvature;- Returns:
- clothoid based on curvature and length.
-
getStartPoint
public org.djutils.draw.point.OrientedPoint2d getStartPoint()Description copied from interface:ContinuousLineStart point.- Specified by:
getStartPointin interfaceContinuousLine- Returns:
- start point
-
getEndPoint
public org.djutils.draw.point.OrientedPoint2d getEndPoint()Description copied from interface:ContinuousLineEnd point.- Specified by:
getEndPointin interfaceContinuousLine- Returns:
- end point
-
getStartCurvature
public double getStartCurvature()Description copied from interface:ContinuousLineStart curvature.- Specified by:
getStartCurvaturein interfaceContinuousLine- Returns:
- start curvature
-
getEndCurvature
public double getEndCurvature()Description copied from interface:ContinuousLineEnd curvature.- Specified by:
getEndCurvaturein interfaceContinuousLine- Returns:
- end curvature
-
getStartRadius
public double getStartRadius()Description copied from interface:ContinuousLineStart radius.- Specified by:
getStartRadiusin interfaceContinuousLine- Returns:
- start radius
-
getEndRadius
public double getEndRadius()Description copied from interface:ContinuousLineEnd radius.- Specified by:
getEndRadiusin interfaceContinuousLine- Returns:
- end radius
-
getA
public double getA()Return A, the clothoid scaling parameter.- Returns:
- a, the clothoid scaling parameter.
-
flatten
Description copied from interface:ContinuousLineFlatten continuous line in to a polyline. Implementations should use the flattener when relevant and possible.- Specified by:
flattenin interfaceContinuousLine- Parameters:
flattener- flattener- Returns:
- flattened line
-
flattenOffset
public org.djutils.draw.line.PolyLine2d flattenOffset(ContinuousLine.ContinuousDoubleFunction offset, Flattener flattener) Description copied from interface:ContinuousLineFlatten continuous line offset in to a polyline. Implementations should use the flattener when relevant and possible.- Specified by:
flattenOffsetin interfaceContinuousLine- Parameters:
offset- offset dataflattener- flattener- Returns:
- flattened line
-
getLength
public double getLength()Description copied from interface:ContinuousLineReturn the length of the line.- Specified by:
getLengthin interfaceContinuousLine- Returns:
- 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:
- "Clothoid", "Arc" or "Straight".
-
toString
-