当前位置: 首页>>代码示例>>Python>>正文


Python GeomUtils.averageDistance方法代码示例

本文整理汇总了Python中Utils.GeomUtils.averageDistance方法的典型用法代码示例。如果您正苦于以下问题:Python GeomUtils.averageDistance方法的具体用法?Python GeomUtils.averageDistance怎么用?Python GeomUtils.averageDistance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Utils.GeomUtils的用法示例。


在下文中一共展示了GeomUtils.averageDistance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: onStrokeAdded

# 需要导入模块: from Utils import GeomUtils [as 别名]
# 或者: from Utils.GeomUtils import averageDistance [as 别名]
    def onStrokeAdded( self, stroke ):
        "Watches for Strokes with Circularity > threshold to Annotate"
        # need at least 6 points to be a circle
	if stroke.length()<6:
            return
        strokeLen = GeomUtils.strokeLength(stroke)
        distCutoff = NodeMarker.CLOSED_DIST_THRESH * (strokeLen ** 2)
	#s_norm = GeomUtils.strokeNormalizeSpacing( stroke, 20 ) 
        ep1 = stroke.Points[0]
        ep2 = stroke.Points[-1]

        epDist = GeomUtils.pointDistanceSquared(ep1.X, ep1.Y, ep2.X, ep2.Y)
        if epDist <= distCutoff:
            avgDist = GeomUtils.averageDistance( stroke.Center, stroke.Points )
            self.getBoard().AnnotateStrokes([stroke], DiGraphNodeAnnotation(0, stroke.Center, avgDist))
        else:
            node_log.debug("Not a node: endpoint distance %s > %s" % (epDist, distCutoff))
开发者ID:jbrowne,项目名称:UCSBsketch,代码行数:19,代码来源:DiGraphObserver.py

示例2: onStrokeAdded

# 需要导入模块: from Utils import GeomUtils [as 别名]
# 或者: from Utils.GeomUtils import averageDistance [as 别名]
    def onStrokeAdded( self, stroke ):
        "Watches for Strokes with Circularity > threshold to Annotate"
        # need at least 6 points to be a circle
	if stroke.length()<6:
            return
	s_norm = GeomUtils.strokeNormalizeSpacing( stroke, 20 ) 
	s_chop = GeomUtils.strokeChopEnds( s_norm, 0.20 ) 
        circ_norm = GeomUtils.strokeCircularity( s_norm ) 
        circ_chop = GeomUtils.strokeCircularity( s_chop ) 

        logger.debug( "stroke: %s", [str(p) for p in s_norm.Points] )
        logger.debug( "potential circles (%f,%f) <> %f", circ_norm, circ_chop, self.threshold )

        if( circ_norm>self.threshold or circ_chop>self.threshold):
            cen = stroke.Center
            avgDist = GeomUtils.averageDistance( cen, stroke.Points )
            anno = CircleAnnotation( circ_norm, cen, avgDist )
            BoardSingleton().AnnotateStrokes( [stroke],  anno)
开发者ID:loserpenguin15,项目名称:UCSBsketch,代码行数:20,代码来源:CircleObserver.py


注:本文中的Utils.GeomUtils.averageDistance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。