def ifs_calculate(self):
     if self.clear == True:
         self.clear = False
         self.initpos = [0, 0]
         # 不绘制迭代的初始100个点
         x, y, c = ifs( self.tool.get_areas(), self.tool.get_eqs(), self.initpos, 100)
         self.initpos = [x[-1], y[-1]]
         self.draw = True
     
     if self.draw and len(self.data["x"]) < ITER_COUNT * ITER_TIMES:
         x, y, c = ifs( self.tool.get_areas(), self.tool.get_eqs(), self.initpos, ITER_COUNT)
         ox, oy, oc = self.data["x"], self.data["y"], self.data["c"]
         if np.max(np.abs(x)) < 1000000 and np.max(np.abs(y)) < 1000000:
             self.initpos = [x[-1], y[-1]]
             x, y, z = np.hstack((ox, x)), np.hstack((oy, y)), np.hstack((oc, c))
             self.data["x"], self.data["y"], self.data["c"] = x, y, z
             # 调整绘图范围,保持X-Y轴的比例为1:1
             xmin, xmax = np.min(x), np.max(x)                
             ymin, ymax = np.min(y), np.max(y)
             xptp, yptp = xmax - xmin, ymax-ymin
             xcenter, ycenter =(xmax + xmin) / 2.0 , (ymax + ymin) / 2.0
             w, h = float(self.plot.width), float(self.plot.height)
             scale = max(xptp/w , yptp/h)
             self.plot.index_range.low = xcenter - 0.5*scale*w
             self.plot.index_range.high = xcenter + 0.5*scale*w
             self.plot.value_range.low = ycenter - 0.5*scale*h
             self.plot.value_range.high = ycenter + 0.5*scale
示例#2
0
    def ifs_calculate(self):
        if self.clear == True:
            self.clear = False
            self.initpos = [0, 0]
            # 不绘制迭代的初始100个点
            x, y, c = ifs( self.ifs_triangle.get_areas(), self.ifs_triangle.get_eqs(), self.initpos, 100)
            self.initpos = [x[-1], y[-1]]
            self.ax2.clear()

        x, y, c = ifs( self.ifs_triangle.get_areas(), self.ifs_triangle.get_eqs(), self.initpos, ITER_COUNT)
        if np.max(np.abs(x)) < 1000000 and np.max(np.abs(y)) < 1000000:
            self.initpos = [x[-1], y[-1]]
            self.draw_points(x, y, c)
    def ifs_calculate(self):
        if self.clear == True:
            self.clear = False
            self.initpos = [0, 0]
            # 不绘制迭代的初始100个点
            x, y, c = ifs( self.ifs_triangle.get_areas(), self.ifs_triangle.get_eqs(), self.initpos, 100)
            self.initpos = [x[-1], y[-1]]
            self.ax2.clear()

        x, y, c = ifs( self.ifs_triangle.get_areas(), self.ifs_triangle.get_eqs(), self.initpos, ITER_COUNT)
        if np.max(np.abs(x)) < 1000000 and np.max(np.abs(y)) < 1000000:
            self.initpos = [x[-1], y[-1]]
            self.draw_points(x, y, c)