Record Class Fresnel

java.lang.Object
java.lang.Record
org.opentrafficsim.core.geometry.Fresnel
Record Components:
c - C value of Fresnel integral
s - S value of Fresnel integral

public record Fresnel(double c, double s) extends Record
Utility class to create clothoid lines, in particular the Fresnel integral based on:
  • W.J. Cody (1968) Chebyshev approximations for the Fresnel integrals. Mathematics of Computation, Vol. 22, Issue 102, pp. 450–453.

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:
  • Cody (1968) (note: tables with values not included in pdf)
  • Constructor Summary

    Constructors
    Constructor
    Description
    Fresnel(double c, double s)
    Creates an instance of a Fresnel record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    c()
    Returns the value of the c record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    static Fresnel
    integral(double x)
    Approximate the Fresnel integral.
    double
    s()
    Returns the value of the s record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Fresnel

      public Fresnel(double c, double s)
      Creates an instance of a Fresnel record class.
      Parameters:
      c - the value for the c record component
      s - the value for the s record component
  • Method Details

    • integral

      public static Fresnel integral(double x)
      Approximate the Fresnel integral. The method used is based on Cody (1968). This method applies rational approximation to approximate the clothoid. For clothoid rotation beyond 1.6 rad, this occurs in polar form. The polar form is robust for arbitrary large numbers, unlike polynomial expansion, and will at a large threshold converge to (0.5, 0.5). There are 5 regions with different fitted values for the rational approximations, in Cartesian or polar form.

      W.J. Cody (1968) Chebyshev approximations for the Fresnel integrals. Mathematics of Computation, Vol. 22, Issue 102, pp. 450–453.
      Parameters:
      x - length along the standard Fresnel integral (no scaling).
      Returns:
      array with two double values c and s
      See Also:
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • c

      public double c()
      Returns the value of the c record component.
      Returns:
      the value of the c record component
    • s

      public double s()
      Returns the value of the s record component.
      Returns:
      the value of the s record component