double CalcAngle(MyPoint first, MyPoint cen, MyPoint second) { double dx1, dx2, dy1, dy2; double angle; dx1 = first.x - cen.x; dy1 = first.y - cen.y; dx2 = second.x - cen.x; dy2 = second.y - cen.y; double c = (double)sqrt(dx1 * dx1 + dy1 * dy1) * (double)sqrt(dx2 * dx2 + dy2 * dy2); if (c == 0) return -1; angle = (double)acos((dx1 * dx2 + dy1 * dy2) / c); return angle / PAI * 180; }