如下所示:
創(chuàng)新互聯(lián)建站主要從事做網(wǎng)站、成都網(wǎng)站設(shè)計(jì)、網(wǎng)頁設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)德惠,10余年網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):18982081108def mat_inter(box1,box2): # 判斷兩個(gè)矩形是否相交 # box=(xA,yA,xB,yB) x01, y01, x02, y02 = box1 x11, y11, x12, y12 = box2 lx = abs((x01 + x02) / 2 - (x11 + x12) / 2) ly = abs((y01 + y02) / 2 - (y11 + y12) / 2) sax = abs(x01 - x02) sbx = abs(x11 - x12) say = abs(y01 - y02) sby = abs(y11 - y12) if lx <= (sax + sbx) / 2 and ly <= (say + sby) / 2: return True else: return False def solve_coincide(box1,box2): # box=(xA,yA,xB,yB) # 計(jì)算兩個(gè)矩形框的重合度 if mat_inter(box1,box2)==True: x01, y01, x02, y02 = box1 x11, y11, x12, y12 = box2 col=min(x02,x12)-max(x01,x11) row=min(y02,y12)-max(y01,y11) intersection=col*row area1=(x02-x01)*(y02-y01) area2=(x12-x11)*(y12-y11) coincide=intersection/(area1+area2-intersection) return coincide else: return False