First,

`p1.X / p1.Y`

and

`p2.X / p2.Y`

are both exactly 1.0, so the result of the difference of the

`Atan`

values is 0.

Fundamentally, you're calculating this incorrectly, try:

public static double GetAngleBetween(Point p1, Point p2)
{
double deltaX = (double)(p2.X - p1.X);
if (deltaX < 1e-10)
return Math.PI / 2.0;
return Math.Atan(((double)(p2.Y - p1.Y)) / deltaX);
}

Also, note that this returns the angle in

**radians counterclockwise **from the positive X direction with the origin at

`Point p1`

. To convert from radians to degrees multiply by

`180 / π`

:

double angle = GetAngleBetween(new Point(1, 1), new Point(2, 2)) * 180.0 / Math.PI;
angle = GetAngleBetween(new Point(0, 0), new Point(1, 2)) * 180.0 / Math.PI;