xocoatzin / pyeuclid

Automatically exported from code.google.com/p/pyeuclid
0 stars 0 forks source link

Feture request: Angles between vectors #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello, I was interested in getting the angle between two vectors and wrote
some code to do it. Might be useful for other people.

def angle(v1, v2):
    '''Returns angle between two Vector3's.'''
    q = v1.normalized().dot(v2.normalized())
    if q < -1.0: return pi
    elif q > 1.0: return 0.0
    else: return acos(q)

Original issue reported on code.google.com by chris.fl...@gmail.com on 4 Feb 2010 at 4:09

GoogleCodeExporter commented 9 years ago
Yesterday I added Vector2.angle(other) and Vector3.angle(other) that implement 
this request.

Original comment by dov.grob...@gmail.com on 5 Apr 2011 at 7:18