1. 先求出线的方向角(用向量)
// 得到两点的角度
// 0 - 360 以 point1 为圆心绕一周
double getAngleFromTwoPoint(CPoint point1, CPoint point2)
{
double angle = 0;
CPoint O = point1; //以第一点为圆心旋转
CPoint A = point2;
double r = getTheRealLengthOfTheLine(O, A, FALSE); //这只是求两点间距离很简单的我就不贴了
CPoint B = CPoint(O.x + r, O.y); //以圆心O为起点 O点右侧距离r个像素长度做B点(O->B)
CPoint OA = CPoint(A.x - O.x, A.y - O.y); //向量OA O->A
CPoint OB = CPoint(B.x - O.x, B.y - O.y); //向量OB O->B
double sin = (OA.x * OB.y - OB.x * OA.y) / (r * r); // |OA| = |OB| = r
angle = ASIN(sin); //弧度 ASIN(c) = (asin(c) * (180.0 / PI))
if (O.x < A.x && O.y > A.y) //象限1