Function makeBoundedLinear

  • Linear interpolation.

    Given two points, this function will find the line segment that connects the two points.

    Parameters

    • x1: number

      One valid input.

    • y1: number

      The expected output at x1.

    • x2: number

      Another valid input.

    • y2: number

      The expected output at x2.

    Returns LinearFunction

    A function that takes x as an input. If x is between x1 and x2, return the corresponding y from the line segment. Outside of the line segment, the function is flat. I.e. f(-Infinity) == f(min(x1,x2) - 100) == f(min(x1,x2)). And f(Infinity) == f(max(x1,x2) + 100) == f(max(x1,x2)). Inputs and outputs of makeBoundedLinear()