Пример #1
0
 def shrink(self):
     self.new_height = self.height * 0.95
     self.cur_polys = []
     for poly in self.polys:
         top_index = GeoFunc.checkTop(poly)
         delta = self.new_height - poly[top_index][1]
         if delta >= 0:
             self.cur_polys.append(GeoFunc.copyPoly(poly))
         else:
             self.cur_polys.append(GeoFunc.getSlide(poly, 0, delta))
Пример #2
0
    def getInnerFitRectangleNew(self,poly):
        '''
        获得IFR,不平移
        '''
        poly_index=GeoFunc.checkBottom(poly)
        left_index,bottom_index,right_index,top_index=GeoFunc.checkBound(poly)
        
        move_x=poly[left_index][0]
        move_y=poly[top_index][1]
        new_poly=GeoFunc.getSlide(poly,-move_x,-move_y)

        refer_pt=[new_poly[poly_index][0],new_poly[poly_index][1]]
        width=self.width-new_poly[right_index][0]
        height=self.height-new_poly[bottom_index][1]

        IFR=[refer_pt,[refer_pt[0]+width,refer_pt[1]],[refer_pt[0]+width,refer_pt[1]+height],[refer_pt[0],refer_pt[1]+height]]
        print("计算出结果:",IFR)

        return IFR