关于叉乘符号与向量的角度方向关系,请参考《算法导论》,我只给出结论:
p1 * p2 = x1y2 - x2 y1 = -p2 * p1
If p1 * p2 is positive, then p1 is clockwise from p2 with respect to the origin (0, 0); if this cross product is negative, then p1 is counterclockwise from p2.
另外考虑的是共线(collinear )的问题, arcsine很难处理这个问题, 不过arecosine却能够明确的区分0和pi,因此作为特殊情况提前得出结论。
ps.因为主要是openGL要用, 所以返回的是角度值
/************************************************************************/
/* author : Na
/* author : Na