def indexate(points):
    """
    Create an array of unique points and indexes into this array.

    Arguments:
        points: A sequence of 3-tuples

    Returns:
        An array of indices and a sequence of unique 3-tuples.
    """
    pd = {}
    indices = tuple(pd.setdefault(tuple(p), len(pd)) for p in points)
    pt = sorted([(v, k) for k, v in pd.items()], key=lambda x: x[0])
    unique = tuple(i[1] for i in pt)
    return indices, unique