def getHeight(self): _max=0 for i in range(1,len(self.polygons)): top_index=GeoFunc.checkTop(self.polygons[i]) top=self.polygons[i][top_index][1] if top>_max: _max=top self.contain_height=_max PltFunc.addLine([[0,self.contain_height],[self.width,self.contain_height]],color="blue")
def showResult(self, **kw): if "current" in kw and kw["current"] == True: for poly in self.cur_polys: PltFunc.addPolygonColor(poly) PltFunc.addLine( [[0, self.new_height], [self.width, self.new_height]], color="blue") if "initial" in kw and kw["initial"] == True: for poly in self.polys: PltFunc.addPolygon(poly) PltFunc.addLine([[0, self.height], [self.width, self.height]], color="blue") PltFunc.showPlt()
def pltArea(self): A, B, C = 0, 0, 0 for i, coefficient in enumerate(self.break_points_list): print(coefficient) A = A + coefficient[1] B = A + coefficient[2] C = A + coefficient[3] if i > 0: x = [self.break_points_list[i - 1][0], coefficient[0]] else: x = [0, coefficient[0]] y0 = self.getQuadratic(x[0], A, B, C) y1 = self.getQuadratic(x[1], A, B, C) PltFunc.addLine([[x[0], y0], [x[1], y1]]) PltFunc.showPlt()
def showAll(self): for i in range(0,len(self.polygons)): PltFunc.addPolygon(self.polygons[i]) length=max(self.width,self.contain_height) PltFunc.addLine([[self.width,0],[self.width,self.contain_height]],color="blue") PltFunc.showPlt(width=length,height=length)