def a_of_bezier(t, cx, cy):
    """
    Returns the acceleration of a cubic Bezier curve at t where t is in [0,1]
    """

    A = (
        (cy[2] - 2 * cy[1] + cy[0]) * cx[3]
        + (-cy[3] + 3 * cy[1] - 2 * cy[0]) * cx[2]
        + (2 * cy[3] - 3 * cy[2] + cy[0]) * cx[1]
        + (-cy[3] + 2 * cy[2] - cy[1]) * cx[0]
    )
    B = (
        (cy[1] - cy[0]) * cx[3]
        + (3 * cy[0] - 3 * cy[1]) * cx[2]
        + (-cy[3] + 3 * cy[2] - 2 * cy[0]) * cx[1]
        + (cy[3] - 3 * cy[2] + 2 * cy[1]) * cx[0]
    )
    C = (cy[1] - cy[0]) * cx[2] + (cy[0] - cy[2]) * cx[1] + (cy[2] - cy[1]) * cx[0]
    D = cx[3] - 3 * cx[2] + 3 * cx[1] - cx[0]
    E = 2 * cx[2] - 4 * cx[1] + 2 * cx[0]
    F = cx[1] - cx[0]
    dx_dt = (
        -3 * (1 - t) ** 2 * cx[0]
        + 3 * (3 * t**2 - 4 * t + 1) * cx[1]
        + 3 * (2 * t - 3 * t**2) * cx[2]
        + 3 * t**2 * cx[3]
    )

    return -2 * (A * t**2 + B * t + C) / (D * t**2 + E * t + F) ** 2 / dx_dt

    Returns the acceleration of a cubic Bezier curve at t where t is in [0,1]
    
infinigen/core/util/imu.py