def getRadial(params): rangeLists = [dim['range'] for dim in params['dimensions']] if len(rangeLists) != 2: raise ValueError("radial algorithm only implemented for two dimensions") ranges = [u.rangeIncludingBounds(low, high) for (low, high) in rangeLists] offset = params['offsetAngle'] gap = params['gapAngle'] maxDev = params['maximumDeviation'] return ra.getGenerator(ranges, offset, gap, maxDev)
def getRadial(params): rangeLists = [dim['range'] for dim in params['dimensions']] if len(rangeLists) != 2: raise ValueError( "radial algorithm only implemented for two dimensions") ranges = [u.rangeIncludingBounds(low, high) for (low, high) in rangeLists] offset = params['offsetAngle'] gap = params['gapAngle'] maxDev = params['maximumDeviation'] return ra.getGenerator(ranges, offset, gap, maxDev)
def getGenerator(ranges, blurWidth, offsetAngle, gapAngle, maximumDeviation): xmin, ymin = min(ranges[0]), min(ranges[1]) xmax, ymax = max(ranges[0]), max(ranges[1]) xw, yw = xmax - xmin, ymax - ymin points = rad.getGenerator(ranges, offsetAngle, gapAngle, maximumDeviation)() blurredPoints = [] for (x,y) in points: (xbump, ybump) = myRand(blurWidth), myRand(blurWidth) nx, ny = xbump + x, ybump + y if nx < xmin: continue # nx = nx + xw elif nx > xmax: nx = nx - xw if ny < ymin: continue # ny = ny + yw elif ny > ymax: ny = ny - yw blurredPoints.append((nx, ny)) blurredSet = set(blurredPoints) return lambda: blurredSet