public
static
float
Angle(Point cen, Point first, Point second)
{
float
dx1, dx2, dy1, dy2;
float
angle;
dx1 = first.X - cen.X;
dy1 = first.Y - cen.Y;
dx2 = second.X - cen.X;
dy2 = second.Y - cen.Y;
float
c = (
float
)Math.Sqrt(dx1 * dx1 + dy1 * dy1) * (
float
)Math.Sqrt(dx2 * dx2 + dy2 * dy2);
if
(c == 0)
return
-1;
angle = (
float
)Math.Acos((dx1 * dx2 + dy1 * dy2) / c);
return
angle;
}