本文整理汇总了Python中Utils.GeomUtils.pointDist方法的典型用法代码示例。如果您正苦于以下问题:Python GeomUtils.pointDist方法的具体用法?Python GeomUtils.pointDist怎么用?Python GeomUtils.pointDist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils.GeomUtils
的用法示例。
在下文中一共展示了GeomUtils.pointDist方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tailToNode
# 需要导入模块: from Utils import GeomUtils [as 别名]
# 或者: from Utils.GeomUtils import pointDist [as 别名]
def tailToNode( self, arrow_anno, circle_anno ):
"return true if the tail of the arrow comes from the circle"
lineDist = max(len(arrow_anno.tailstroke.Points) / 10, 1) #Check the last 10th of the stroke points the right way
if arrow_anno.direction == "tail2head":
lineSeg = ( arrow_anno.tailstroke.Points[lineDist], arrow_anno.tailstroke.Points[0] )
else: #direction == 'head2tail'
lineSeg = ( arrow_anno.tailstroke.Points[-lineDist], arrow_anno.tailstroke.Points[-1] )
if GeomUtils.pointDist( arrow_anno.tail, circle_anno.center ) < circle_anno.radius* DiGraphAnnotation.MATCHING_DISTANCE:
if GeomUtils.linePointsTowards( lineSeg[0], lineSeg[1], circle_anno.center, circle_anno.radius * DiGraphAnnotation.POINTSTO_DISTANCE):
return True
return False
示例2: collectionFromItem
# 需要导入模块: from Utils import GeomUtils [as 别名]
# 或者: from Utils.GeomUtils import pointDist [as 别名]
def collectionFromItem( self, strokes, annotation ):
text_anno = None # text_anno will be the return value
if annotation.isType( CircleObserver.CircleAnnotation ):
circle = annotation
text_anno = TextAnnotation("0",circle.radius*2)
if annotation.isType( LineObserver.LineAnnotation ):
line = annotation
# if the line is up/down then it is a one
if GeomUtils.angleParallel( line.angle, 90 ) > 0.6:
line_length = GeomUtils.pointDist( line.start_point, line.end_point )
text_anno = TextAnnotation("1",line_length)
return text_anno
示例3: tipToNode
# 需要导入模块: from Utils import GeomUtils [as 别名]
# 或者: from Utils.GeomUtils import pointDist [as 别名]
def tipToNode( self, arrow_anno, circle_anno ):
"return true if the tip of the arrow points to the circle"
lineDist = min(10, max(len(arrow_anno.tailstroke.Points) / 10, 1)) #Check the last 10th of the stroke points the right way
#lineseg: two points from arrow "neck" to arrowhead tip
#lineseg2: two points from arrow "neck" to last point in tail stroke
if arrow_anno.direction == "tail2head":
lineSeg = ( arrow_anno.tailstroke.Points[-lineDist], arrow_anno.tip )
lineSeg2 = ( arrow_anno.tailstroke.Points[-lineDist], arrow_anno.tailstroke.Points[-1] )
else: #direction == 'head2tail'
lineSeg = ( arrow_anno.tailstroke.Points[lineDist], arrow_anno.tip )
lineSeg2 = ( arrow_anno.tailstroke.Points[lineDist], arrow_anno.tailstroke.Points[0] )
if GeomUtils.pointDist( arrow_anno.tip, circle_anno.center ) < circle_anno.radius* DiGraphAnnotation.MATCHING_DISTANCE:
if GeomUtils.linePointsTowards( lineSeg[0], lineSeg[1], circle_anno.center, circle_anno.radius * DiGraphAnnotation.POINTSTO_DISTANCE):
return True
if GeomUtils.linePointsTowards( lineSeg2[0], lineSeg2[1], circle_anno.center, circle_anno.radius * DiGraphAnnotation.POINTSTO_DISTANCE):
return True
return False
示例4: distance
# 需要导入模块: from Utils import GeomUtils [as 别名]
# 或者: from Utils.GeomUtils import pointDist [as 别名]
def distance(self, point2):
"Returns the distance from this point to the point in argument 1"
from Utils import GeomUtils
return GeomUtils.pointDist(self, point2)
示例5: tailToNode
# 需要导入模块: from Utils import GeomUtils [as 别名]
# 或者: from Utils.GeomUtils import pointDist [as 别名]
def tailToNode( self, arrow_anno, circle_anno ):
"return true if the tail of the arrow comes from the circle"
return GeomUtils.pointDist( arrow_anno.tail, circle_anno.center ) < circle_anno.radius*1.5
示例6: tipToNode
# 需要导入模块: from Utils import GeomUtils [as 别名]
# 或者: from Utils.GeomUtils import pointDist [as 别名]
def tipToNode( self, arrow_anno, circle_anno ):
"return true if the tip of the arrow points to the circle"
return GeomUtils.pointDist( arrow_anno.tip, circle_anno.center ) < circle_anno.radius*1.5