Beispiel #1
0
def all_paths_to_points(points, listify=False):

    if not points:
        raise StopIteration

    # could be list or set we're given
    try:
        l = len(points[0])
    except TypeError:
        e = points.pop()
        l = len(e)
        points.add(e)

    center = (0,) * l

    for coord in points:
        path = raytracing2.gen_path_bounded_absolute(center, coord)
        # path = raytracing2.get_path(center, coord)

        if listify:
            path = list(path) # defeats the purpose of an iterator!

        yield path
Beispiel #2
0
def generate_all_rays(shell, dimensions):
    return [list(raytracing2.gen_path_bounded_absolute( origin(dimensions), coord )) for coord in shell]