def basis_function(degree, knot_vector, span, t):
    """Computes the non-vanishing basis functions for a single parameter t.

    Implementation of Algorithm A2.2 from The NURBS Book by Piegl & Tiller.
    Uses recurrence to compute the basis functions, also known as Cox - de
    Boor recursion formula.
    """
    left = [0.0 for _ in range(degree + 1)]
    right = [0.0 for _ in range(degree + 1)]
    N = [1.0 for _ in range(degree + 1)]

    for j in range(1, degree + 1):
        left[j] = t - knot_vector[span + 1 - j]
        right[j] = knot_vector[span + j] - t
        saved = 0.0
        for r in range(0, j):
            temp = N[r] / (right[r + 1] + left[j - r])
            N[r] = saved + right[r + 1] * temp
            saved = left[j - r] * temp
        N[j] = saved
    return N