def angle_vectors_xy(u, v, deg=False): """Compute the smallest angle between the XY components of two vectors. Parameters ---------- u : sequence of float The first 2D or 3D vector (Z will be ignored). v : sequence of float) The second 2D or 3D vector (Z will be ignored). deg : boolean returns angle in degrees if True Returns ------- float The smallest angle between the vectors in radians (in degrees if deg == True). The angle is always positive. Examples -------- >>> """ a = dot_vectors_xy(u, v) / (length_vector_xy(u) * length_vector_xy(v)) a = max(min(a, 1), -1) if deg: return degrees(acos(a)) return acos(a)
def angle_smallest_vectors_xy(u, v): """Compute the smallest angle (radians) between the XY components of two vectors lying in the XY-plane. Parameters ---------- u : sequence of float The first 2D or 3D vector (Z will be ignored). v : sequence of float) The second 2D or 3D vector (Z will be ignored). Returns ------- float The smallest angle between the vectors in radians. The angle is always positive. Examples -------- >>> """ a = dot_vectors_xy(u, v) / (length_vector_xy(u) * length_vector_xy(v)) a = max(min(a, 1), -1) return acos(a)