def encode_parts(relative_shifts):
    parts = np.zeros((len(relative_shifts),), dtype=np.int32)
    mask = ((relative_shifts[:, 0] >= 0) & (relative_shifts[:, 1] >= 0))
    parts[mask] = 0
    mask = ((relative_shifts[:, 0] < 0) & (relative_shifts[:, 1] >= 0))
    parts[mask] = 1
    mask = ((relative_shifts[:, 0] < 0) & (relative_shifts[:, 1] < 0))
    parts[mask] = 2
    mask = ((relative_shifts[:, 0] >= 0) & (relative_shifts[:, 1] < 0))
    parts[mask] = 3
    return parts
def encode_parts(relative_shifts):
    parts = np.zeros((len(relative_shifts),), dtype=np.int32)
    mask = ((relative_shifts[:, 0] >= 0) & (relative_shifts[:, 1] >= 0))
    parts[mask] = 0
    mask = ((relative_shifts[:, 0] < 0) & (relative_shifts[:, 1] >= 0))
    parts[mask] = 1
    mask = ((relative_shifts[:, 0] < 0) & (relative_shifts[:, 1] < 0))
    parts[mask] = 2
    mask = ((relative_shifts[:, 0] >= 0) & (relative_shifts[:, 1] < 0))
    parts[mask] = 3
    return parts