Class Clothoid


  • public final class Clothoid
    extends Object
    Generate an OTSLine3D for a clothoid.
    Derived from odrSpiral.c by M. Dupuis @ VIRES GmbH
            Licensed under the Apache License, Version 2.0 (the "License");
            you may not use this file except in compliance with the License.
            You may obtain a copy of the License at
     
                http://www.apache.org/licenses/LICENSE-2.0
     
            Unless required by applicable law or agreed to in writing, software
            distributed under the License is distributed on an "AS IS" BASIS,
            WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
            See the License for the specific language governing permissions and
            limitations under the License.
     

    Copyright (c) 2013-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
    BSD-style license. See OpenTrafficSim License.

    Version:
    $Revision$, $LastChangedDate$, by $Author$, initial version Nov 2, 2015
    Author:
    M. Dupuis @ VIRES GmbH, Alexander Verbraeck, Peter Knoppers
    • Field Detail

      • SN

        static final double[] SN
        S(x) for small x numerator.
      • SD

        static final double[] SD
        S(x) for small x denominator.
      • CN

        static final double[] CN
        C(x) for small x numerator.
      • CD

        static final double[] CD
        C(x) for small x denominator.
      • FN

        static final double[] FN
        Auxiliary function f(x) numerator.
      • FD

        static final double[] FD
        Auxiliary function f(x) denominator.
      • GN

        static final double[] GN
        Auxiliary function g(x) numerator.
      • GD

        static final double[] GD
        Auxiliary function g(x) denominator.
    • Method Detail

      • clothoid

        public static OTSLine3D clothoid​(OTSPoint3D start,
                                         Direction startDirection,
                                         double endCurvature,
                                         Length length,
                                         Length endElevation,
                                         int numSegments)
                                  throws OTSGeometryException
        Approximate a clothoid with curvature 0 at start.
        Parameters:
        start - OTSPoint3D; starting point of the clothoid
        startDirection - Direction; start direction of the clothoid
        endCurvature - double; curvature at the end of the clothoid [1/m]
        length - Length; length of the clothoid
        endElevation - Length; elevation at end of the clothoid
        numSegments - int; number of segments used to approximate (the number of points is one higher than this)
        Returns:
        OTSLine3D; the clothoid
        Throws:
        OTSGeometryException - if the number of segments is too low
      • clothoid

        public static OTSLine3D clothoid​(OTSPoint3D start,
                                         Direction startDirection,
                                         double startCurvature,
                                         double endCurvature,
                                         Length length,
                                         Length endElevation,
                                         int numSegments)
                                  throws OTSGeometryException
        Approximate a clothoid.
        Parameters:
        start - OTSPoint3D; starting point of the clothoid
        startDirection - Direction; start direction of the clothoid
        startCurvature - double; curvature at the start of the clothoid [1/m]
        endCurvature - double; curvature at the end of the clothoid [1/m]
        length - Length; length of the clothoid
        endElevation - Length; elevation at end of the clothoid
        numSegments - int; number of segments used to approximate (the number of points is one higher than this)
        Returns:
        OTSLine3D; the clothoid
        Throws:
        OTSGeometryException - if the number of segments is too low
      • clothoid

        public static OTSLine3D clothoid​(OTSPoint3D start,
                                         Direction startDirection,
                                         LinearDensity endCurvature,
                                         Length length,
                                         Length endElevation,
                                         int numSegments)
                                  throws OTSGeometryException
        Approximate a clothoid with curvature 0 at start.
        Parameters:
        start - OTSPoint3D; starting point of the clothoid
        startDirection - Direction; start direction of the clothoid
        endCurvature - LinearDensity; curvature at the end of the clothoid
        length - Length; length of the clothoid
        endElevation - Length; elevation at end of the clothoid
        numSegments - int; number of segments used to approximate (the number of points is one higher than this)
        Returns:
        OTSLine3D; the clothoid
        Throws:
        OTSGeometryException - if the number of segments is too low
      • clothoid

        public static OTSLine3D clothoid​(OTSPoint3D start,
                                         Direction startDirection,
                                         LinearDensity startCurvature,
                                         LinearDensity endCurvature,
                                         Length length,
                                         Length endElevation,
                                         int numSegments)
                                  throws OTSGeometryException
        Approximate a clothoid.
        Parameters:
        start - OTSPoint3D; starting point of the clothoid
        startDirection - Direction; start direction of the clothoid
        startCurvature - LinearDensity; curvature at the start of the clothoid [1/m]
        endCurvature - LinearDensity; curvature at the end of the clothoid [1/m]
        length - Length; length of the clothoid
        endElevation - Length; elevation at end of the clothoid
        numSegments - int; number of segments used to approximate (the number of points is one higher than this)
        Returns:
        OTSLine3D; the clothoid
        Throws:
        OTSGeometryException - if the number of segments is too low
      • main

        public static void main​(String[] args)
                         throws OTSGeometryException
        Demonstrate / test the clothoid methods.
        Parameters:
        args - String[]; the command line arguments (not used)
        Throws:
        OTSGeometryException - if the number of segments is too low