Class CalcAbstract

Abstract class supporting various arithmetical helper functions

Constructors

Properties

Methods

Constructors

Properties

deg2rad: number = ...

factor multiplied with angle in degrees yields the angle in radian

rad2deg: number = ...

factor multiplied with angle in radian yields the angle in degrees

Methods

  • Returns one of the values passed in, either _value if within _min and _max or the boundary being exceeded by _value

    Type Parameters

    • T

    Parameters

    • _value: T
    • _min: T
    • _max: T
    • _isSmaller: ((_value1, _value2) => boolean) = ...
        • (_value1, _value2): boolean
        • Parameters

          • _value1: T
          • _value2: T

          Returns boolean

    Returns T

  • Returns the linear interpolation between two values (_a, _b) for the given interpolation factor (_f). f is clamped between 0 and 1.

    Parameters

    • _a: number
    • _b: number
    • _f: number

    Returns number

  • Rounds the given value to the nearest multiple of the given increment using the given rounding function. Default rounding function is Math.round, use Math.floor or Math.ceil to round down or up.

    Parameters

    • _value: number
    • _increment: number
    • _round: ((_value) => number) = Math.round
        • (_value): number
        • Parameters

          • _value: number

          Returns number

    Returns number