本文整理匯總了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())