Exemplo n.º 1
0
def getFeasibleByBottom(polys):
    polyList = []
    for poly in polys:
        bottom = poly[GeoFunc.checkBottom(poly)]
        polyList.append({
            "poly": poly,
            "bottom_x": bottom[0],
            "bottom_y": bottom[1]
        })
    sorted(polyList, key=lambda poly: poly["bottom_y"])
    sequence = []
    for item in polyList:
        sequence.append(item["poly"])
    pp = BottomLeftFill(1500, sequence)
    return pp.polygons
Exemplo n.º 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