Class ContinuousClothoid

java.lang.Object
org.opentrafficsim.core.geometry.ContinuousClothoid
All Implemented Interfaces:
ContinuousLine

public class ContinuousClothoid extends Object implements 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.
This class is based on:
  • 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.

Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
See Also:
  • 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. See Clothoid.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 interface ContinuousLine
      Returns:
      OrientedPoint2d; start point.
    • getEndPoint

      public org.djutils.draw.point.OrientedPoint2d getEndPoint()
      End point.
      Specified by:
      getEndPoint in interface ContinuousLine
      Returns:
      OrientedPoint2d; end point.
    • getStartCurvature

      public double getStartCurvature()
      Start curvature.
      Specified by:
      getStartCurvature in interface ContinuousLine
      Returns:
      double; start curvature.
    • getEndCurvature

      public double getEndCurvature()
      End curvature.
      Specified by:
      getEndCurvature in interface ContinuousLine
      Returns:
      double; end curvature.
    • getStartRadius

      public double getStartRadius()
      Start radius.
      Specified by:
      getStartRadius in interface ContinuousLine
      Returns:
      double; start radius.
    • getEndRadius

      public double getEndRadius()
      End radius.
      Specified by:
      getEndRadius in interface ContinuousLine
      Returns:
      double; end radius.
    • getA

      public double getA()
      Return A, the clothoid scaling parameter.
      Returns:
      double; a, the clothoid scaling parameter.
    • flatten

      public org.djutils.draw.line.PolyLine2d flatten(Flattener flattener)
      Flatten continuous line in to a polyline. Implementations should use the flattener when relevant and possible.
      Specified by:
      flatten in interface ContinuousLine
      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 interface ContinuousLine
      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 interface ContinuousLine
      Returns:
      double; length of the line.
    • getAppliedShape

      public String 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

      public String toString()
      Overrides:
      toString in class Object