本文整理汇总了Python中Vector.from_points方法的典型用法代码示例。如果您正苦于以下问题:Python Vector.from_points方法的具体用法?Python Vector.from_points怎么用?Python Vector.from_points使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector
的用法示例。
在下文中一共展示了Vector.from_points方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: points
# 需要导入模块: import Vector [as 别名]
# 或者: from Vector import from_points [as 别名]
self.rect.left = pos2[0]
self.image.set_colorkey( [125,125,125] )
self.dirty = 1
def points(self):
return self.line_seg.points()
def hit(self, pos, vector):
"""
--> tuple
Returns the position and reflection vector as a tuple (pos, vector),
or if there is no unique point of intersection returns None
pos(tuple) --> The origin of the object before movement
vector(Vector) --> The movement vector of the object
"""
return self.line_seg.hit(pos, vector)
if __name__ == "__main__":
from math import degrees
x = Line( (0,0), (4.6025242672622015, 1.9536556424463689) )
yx = Vector()
yx.from_points( (0,0), (4.6025242672622015, 1.9536556424463689) )
print degrees(yx.get_angle())
y = Vector()
y.from_points( (- 2,-2 ), (.5881904510252074,7.6592582628906829) )
print degrees(y.get_angle())
print "expected 331"
print degrees(x.hit( (0,-2), y )[1].get_angle())