Exemplo n.º 1
0
def run_genray():

    from raycasting import Ray
    genray = Ray(20)
    for i in range(20):
        for ray in genray.rays((10,10), 5, (20,20)):
            print ray
Exemplo n.º 2
0
class Grid(object):

    def __init__(self, size):
        
        self._size = size
        self._raygen = Ray(max(size))


    def fov(self, reachable, origin, radius, set_origin=True):
        
        seen = Flags(self._size)
        if set_origin:
            seen[origin] = True
        for ray in self._raygen.rays(origin, radius, self._size):
            for idx in ray:

                seen[idx] = True
                # Stop ray if it hit a wall.
                if not reachable[idx]:
                    break
        return seen

    def get_path(self, flags, start, end):

        astar = AStar(flags, start, end)
        astar.process()
        return astar.path()
Exemplo n.º 3
0
 def __init__(self, size):
     
     self._size = size
     self._raygen = Ray(max(size))