本文整理汇总了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