From picture: I have to calculate alpha, defined as the angle between the lines that connects two points and the y-axis, with a range 0 to 180 in the direction that can be seen in the image, and with a range of 0 to -180 in the opposite (arrow pointing from current starting point to finger1).
(atan2((x1 - x), (y - y1)) * 180/ M_PI );
I managed to do so with this formula, simply inverting x and y reference in atan2 function, but this works only when the first point (x,y) is on "bottom-right" in respect of the second. In that case I get the exact expected result. In all the others obviously I get wrong values. How could I normalise this to get always the same values?

Definition:
Calculate the slope m of v:
Since the value of the slope is the same (sign differs) for the inverted vector v (-v), we can use the absolute value of m.
The angle θ between the positive x-axis and the vector v:
The angle α is:
That is basically what
atan2does, butatan2gives you a value in the range [-π, π]. With the above code, we get a value in the range [0, π / 2].It doesn't matter if the y-axis is presented on the screen from top to bottom or vice versa. The math is the same. But that implies, that you receive your P1 and P2 in the same system. If not, then you have to mirror the points on the x-axis, which is changing the sign of the y-coords of the points.
The detailed version: