本文整理匯總了Python中region.Region.relativePosition方法的典型用法代碼示例。如果您正苦於以下問題:Python Region.relativePosition方法的具體用法?Python Region.relativePosition怎麽用?Python Region.relativePosition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類region.Region
的用法示例。
在下文中一共展示了Region.relativePosition方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: doubleCut
# 需要導入模塊: from region import Region [as 別名]
# 或者: from region.Region import relativePosition [as 別名]
def doubleCut(self, other, doreverse=True):
'''takes self and another AngularDomain, and slices both of them,
i.e.: cuts each region in the endpoints of the other AngularDomains
regions, i.e.: ater this operation, for each region R1 in one
AngularDomain, if there exists an Region R2 in the other so that R1
contains R2 or R2 contains R1, the endpoints of R1 and R2 are the
same.'''
i,j= 0,0
while i<len(self) and j<len(other):
p= Region.relativePosition(self[i],other[j])
if p==1:
i+=1
elif p==2:
j+=1
elif p==3:
self.cutRegionOnPoint(i, other[j][0])
i+=1
other.cutRegionOnPoint(j, self[i][1])
j+=1
elif p==4:
other.cutRegionOnPoint(j, self[i][0])
j+=1
self.cutRegionOnPoint(i, other[j][1])
i+=1
elif p==5:
i= self.cutRegionOnPoint(i, other[j][0])
i= self.cutRegionOnPoint(i, other[j][1])
j+=1
elif p==6:
j= other.cutRegionOnPoint(j, self[i][0])
j= other.cutRegionOnPoint(j, self[i][1])
i+=1