double testx, testy, testdeg, testrad, endx, endy;
testx = 1;
testy = 1;
testdeg = atan2( testx, testy) / Math::PI* 180;
testrad = sqrt(pow(testx,2) + pow(testy,2));
endx = testrad * cos(testdeg);
endy = testrad * sin(testdeg);
Кажется, что все части равны,
кроме endx и endy следует = testx и testy
они делают при расчете вручную.