
Here is a better algorithm for finding a signed angle between two line segments with a common starting point where the angle is measured counterclockwise from 0 to +/ pi.
double sX, sY; //the common starting point
double aX, aY, bX, bY; //the two points radiating from sX,sY
...
//using C# Math.Atan2(y,x) method:
double dRad1 = Math.Atan2(aYsY,aXsX);
double dRad2 = Math.Atan2(bYsY,bXsX);
double dRad = dRad2  dRad1;
note: angles > pi are shown as (pi  angle) 