# Path: attitude/geom/util.py
# def angle(v1,v2, cos=False):
#     """
#     Find the angle between two vectors.
# 
#     :param cos: If True, the cosine of the
#     angle will be returned. False by default.
#     """
#     n = (norm(v1)*norm(v2))
#     _ = dot(v1,v2)/n
#     return _ if cos else N.arccos(_)
# 
# def vector(*args):
#     """
#     A single vector in any coordinate basis,
#     as a numpy array.
#     """
#     return N.array(args)
# 
# def dot(*matrices):
#     return reduce(N.dot, matrices)


import numpy as N
from mplstereonet import stereonet_math, stereonet2xyz, xyz2stereonet
from ..geom.util import angle, vector, dot
"""
Helper functions for rotations

Prior art: http://bl.ocks.org/ivyywang/7c94cb5a3accd9913263
"""
from __future__ import division

def transform(v1, v2):
    """
    Create an affine transformation matrix that maps vector 1
    onto vector 2

    https://math.stackexchange.com/questions/293116/rotating-one-3d-vector-to-another
    """

# Path: attitude/geom/util.py
# def angle(v1,v2, cos=False):
#     """
#     Find the angle between two vectors.
# 
#     :param cos: If True, the cosine of the
#     angle will be returned. False by default.
#     """
#     n = (norm(v1)*norm(v2))
#     _ = dot(v1,v2)/n
#     return _ if cos else N.arccos(_)
# 
# def vector(*args):
#     """
#     A single vector in any coordinate basis,
#     as a numpy array.
#     """
#     return N.array(args)
# 
# def dot(*matrices):
#     return reduce(N.dot, matrices)


# Path: attitude/coordinates/rotations.py
import numpy as N
from mplstereonet import stereonet_math, stereonet2xyz, xyz2stereonet
from ..geom.util import angle, vector, dot

"""
Helper functions for rotations

Prior art: http://bl.ocks.org/ivyywang/7c94cb5a3accd9913263
"""
from __future__ import division

def transform(v1, v2):
    """
    Create an affine transformation matrix that maps vector 1
    onto vector 2

    https://math.stackexchange.com/questions/293116/rotating-one-3d-vector-to-another
    """

    theta = angle(v1,v2)