Polar and Cartesian calculations not completely working?
Posted
by Smoka
on Stack Overflow
See other posts from Stack Overflow
or by Smoka
Published on 2010-06-05T22:02:16Z
Indexed on
2010/06/05
22:12 UTC
Read the original article
Hit count: 272
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);
All parts of this seem to equate properly, except endx and endy should = testx and testy they do when calculating by hand.
© Stack Overflow or respective owner