def translate(params, dx, dy):
    """Translate the model by the specified offset"""
    base = len(params) % 6
    assert base in (0, 1), 'Invalid params length.'
    translated = params.copy()
    translated[base + 1::6] += dx
    translated[base + 2::6] += dy
    return translated