本文整理汇总了Python中Geometry.segment方法的典型用法代码示例。如果您正苦于以下问题:Python Geometry.segment方法的具体用法?Python Geometry.segment怎么用?Python Geometry.segment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Geometry
的用法示例。
在下文中一共展示了Geometry.segment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: finger_vectors_intersect
# 需要导入模块: import Geometry [as 别名]
# 或者: from Geometry import segment [as 别名]
def finger_vectors_intersect(finger1, finger2, vector_length, tolerance):
#Take Leap Finger objects and produce two line segment objects
finger_1_location = Geometry.to_vector(finger1.tip_position)
finger_1_direction = Geometry.to_vector(finger1.direction)
finger_1_vector = finger_1_direction.unit_vector() ** vector_length; #** is scalar mult
finger_1_endpoint = finger_1_vector + finger_1_location
finger_1_segment = Geometry.segment(finger_1_location, finger_1_endpoint)
finger_2_location = Geometry.to_vector(finger2.tip_position)
finger_2_direction = Geometry.to_vector(finger2.direction)
finger_2_vector = finger_2_direction.unit_vector() ** vector_length; #** is scalar mult
finger_2_endpoint = finger_2_vector + finger_2_location
finger_2_segment = Geometry.segment(finger_2_location, finger_2_endpoint)
minimum_distance = finger_1_segment.min_distance_finite(finger_2_segment)
if minimum_distance <= tolerance:
return True
return False