def __init__(self, minCorner=Vector2(0.0, 0.0), size=Vector2(1.0, 1.0), resolution=(1, 1), cellSize=None): '''Grid constructor. @param minCorner A 2-tuple-like instace of floats. The position, in world space, of the "bottom-left" corner of the domain. (Minimum x- and y- values. @param size A 2-tuple-like instace of floats. The span of the domain (in world space.) The maximum values of the domain are minCorner[0] + size[0] and minCorner[1] + size[1], respectively. @param resolution A 2-tuple like instance of ints. The number of cells in the domain in both the x- and y-directions. This will imply a cell size. ''' RectDomain.__init__(self, minCorner, size) self.resolution = resolution # tuple (x, y) - int # size of each cell in the world grid if (cellSize is None): self.cellSize = Vector2(size[0] / float(resolution[0]), size[1] / float(resolution[1])) else: self.cellSize = cellSize assert (np.abs(self.cellSize[0] * self.resolution[0] - self.size[0]) < 0.0001 and np.abs(self.cellSize[1] * self.resolution[1] - self.size[1]) < 0.0001)
def __init__(self, minCorner, size): '''Constructor. @param minCorner A 2-tuple-like instance of floats. The position, in world space, of the "bottom-left" corner of the domain. (Minimum x- and y- values. @param size A 2-tuple-like instace of floats. The span of the domain (in world space.) The maximum values of the domain are minCorner[0] + size[0] and minCorner[1] + size[1], respectively. ''' RectDomain.__init__(self, minCorner, size)