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


Python GeomUtils.rotateStroke方法代码示例

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


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

示例1: Score

# 需要导入模块: from Utils import GeomUtils [as 别名]
# 或者: from Utils.GeomUtils import rotateStroke [as 别名]
 def Score( self, strokelist, max_return = 1, interest = 0.2):
     "Compare these strokes to all templates, and return the best templates with their scores. "
     ROTATIONS = 16
     best_templ = None 
     for stroke_order in itertools.permutations(strokelist):
         pointlist = []
         for s in stroke_order:
             pointlist.extend(s.Points)
         new_stroke = Stroke.Stroke(points=pointlist)
         
         for name, template_set in self._templates.items():
             for template in template_set:
                 for angle in [2 * math.pi / ROTATIONS * i for i in range(ROTATIONS)]:
                     end_template = GeomUtils.rotateStroke(Stroke.Stroke(points=template), angle).Points
                     firstpass_score = _scoreStroke(new_stroke, end_template, 10)
                     if best_templ is not None and firstpass_score - 0.1 > best_templ['score']:
                         continue
                     score = _scoreStroke(new_stroke, end_template, len(end_template))
                     logger.debug("   '%s' ... %s" % (name, score))
             
                     if best_templ is None:
                         best_templ = {'score': score + 1}
                 
                     if score < best_templ['score']:
                         best_templ['name'] = name
                         best_templ['score'] = score
                         best_templ['template'] = end_template
     return best_templ
开发者ID:jbrowne,项目名称:UCSBsketch,代码行数:30,代码来源:Template.py


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