def _interpolate_crop(start: complex, stop: complex, loc: float, axis: int) -> complex:
    """Interpolate between two points at a given coordinates."""

    start_dim, stop_dim = (start.real, stop.real) if axis == 0 else (start.imag, stop.imag)

    diff = stop_dim - start_dim
    if diff == 0:
        raise ValueError("cannot interpolate line parallel to axis")

    r = (loc - start_dim) / diff

    if r < 0.5:
        return start + (stop - start) * r
    else:
        return stop - (stop - start) * (1.0 - r)