def hinged_line(ecc, slope, hinge_ecc, intercept=0):
    """Hinged line with an optional intercept.

    Parameters
    ----------
    ecc : jnp.ndarray
        Eccentricity of RGC cells.
    slope : jnp.ndarray
        The slope giving the relationship between eccentricity and diameter.
    hinge_ecc : jnp.ndarray
        Eccentricity at which the line hinges.
    intercept : jnp.ndarray, optional
        The intercept for the line.

    Returns
    -------
    diameter_mean : jnp.ndarray
        The mean diameter at each location.

    """
    diam = intercept + ecc * slope
    return diam.clip(intercept + hinge_ecc * slope)