'Get the angle around the Z axis difference between a pair of Vector3s.'
分析:
本段函数中,使用atan2函数计算出"subtractVec3在xoy平面上的投影"到"subtractFromVec3在xoy平面上的投影"的夹角。
(2)defgetAngleDifferenceByComplex(subtractFromComplex,subtractComplex):
'Get the angle between a pair of normalized complexes.'
subtractComplexMirror=complex(subtractComplex.real,-subtractComplex.imag)
differenceComplex = subtractComplexMirror * subtractFromComplex
returnmath.atan2(differenceComplex.imag,differenceComplex.real)
'Get the angle between a pair of normalized complexes.'
分析:
本段函数中,先使用complex函数将两个向量转化为复数形式,再使用atan2函数得出两个复数的夹角。