本文整理汇总了Python中Utils.GeomUtils.vectorDistance方法的典型用法代码示例。如果您正苦于以下问题:Python GeomUtils.vectorDistance方法的具体用法?Python GeomUtils.vectorDistance怎么用?Python GeomUtils.vectorDistance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils.GeomUtils
的用法示例。
在下文中一共展示了GeomUtils.vectorDistance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _scoreStroke
# 需要导入模块: from Utils import GeomUtils [as 别名]
# 或者: from Utils.GeomUtils import vectorDistance [as 别名]
def _scoreStroke(stroke, template, sample_size = None):
if sample_size is None:
sample_size = len(template)
sNorm = GeomUtils.strokeNormalizeSpacing(stroke, len(template))
centr = GeomUtils.centroid(sNorm.Points)
numPoints = len(sNorm.Points)
point_vect = []
templ_vect = []
numPoints = len(template)
if len(template) == len(sNorm.Points):
for idx in range(0, numPoints, numPoints/sample_size ):
templ_vect.append(template[idx].X)
templ_vect.append(template[idx].Y)
p = sNorm.Points[idx]
point_vect.append(p.X - centr.X)
point_vect.append(p.Y - centr.Y)
angularDist = GeomUtils.vectorDistance(point_vect, templ_vect)
else:
angularDist = math.pi
return angularDist
示例2: scoreStroke
# 需要导入模块: from Utils import GeomUtils [as 别名]
# 或者: from Utils.GeomUtils import vectorDistance [as 别名]
def scoreStroke(stroke, template):
sNorm = GeomUtils.strokeNormalizeSpacing(stroke, TEMPLATE_SAMPLE)
centr = GeomUtils.centroid(sNorm.Points)
point_vect = []
templ_vect = []
for q in template:
templ_vect.append(q.X)
templ_vect.append(q.Y)
for p in sNorm.Points:
point_vect.append(p.X - centr.X)
point_vect.append(p.Y - centr.Y)
angularDist = GeomUtils.vectorDistance(point_vect, templ_vect)
return angularDist