Constants and Functions

Constants

LouLib contains the following math constants:

  • EPS = \(10^{-9}\)

  • PI = \(\pi \approx 3.14159265358979323846\)

  • E = \(e \approx 2.7182818284590452354\)

  • SQRT2 = \(\sqrt{2} \approx 1.4142135623730950488\)

Functions

LouLib contians the following math functions:

  • int signum(double a)

    Returns 1 times the sign of a.

  • double clamp(double val, double min, double max)

    Returns val limited between min and max

  • double constrainAngle(double x)

    Returns the equivalent angle in the bounds [-180,180)

  • angleDifference(double final, double initial)

    Returns the smallest difference between the final and initial angles

Note

The constrainAngle and angleDifference only works when the angles are in degrees. Using angle measures in radians will result in unexpected results.