@@ -0,0 +1,843 @@
+'''%0AUtilities for geometry%0A'''%0A%0Aimport numpy as np%0A%0A# from http://stackoverflow.com/questions/2827393/%0Adef unit_vector(vector):%0A    '''Returns the unit vector of the vector.'''%0A    return vector / np.linalg.norm(vector)%0A%0A%0A# from http://stackoverflow.com/questions/2827393/%0Adef angle_between(v1, v2):%0A    '''Returns the angle in radians between vectors 'v1' and 'v2'::%0A%0A            %3E%3E%3E angle_between((1, 0, 0), (0, 1, 0))%0A            1.5707963267948966%0A            %3E%3E%3E angle_between((1, 0, 0), (1, 0, 0))%0A            0.0%0A            %3E%3E%3E angle_between((1, 0, 0), (-1, 0, 0))%0A            3.141592653589793%0A    '''%0A    v1_u = unit_vector(v1)%0A    v2_u = unit_vector(v2)%0A    angle = np.arccos(np.dot(v1_u, v2_u))%0A    if np.isnan(angle):%0A        if (v1_u == v2_u).all():%0A            return 0.0%0A        else:%0A            return np.pi%0A    return angle%0A

add geometry module