Im trying to get points of a circle using sin() and cos()...
I did it on the calculator like this
x = circle x + radius * cos(angle)
y = circle y + radius * sin(angle)
x = 240 + 60 * cos(180);
y = 136 + 60 * sin(180);
on the caluculator I get
x = 180 (correct)
y = 136 (also correct)
but when I use the psp's math.h sin() and cos() I get
x = 204
y = 87
???
any Ideas on what is causing this
maybe its a stupid mistake I made, here are the functions I use to get both the x and y values:
int GetCircleCoordX(int x,int r,int angle)
{
return x + r * cos(angle);
}
int GetCircleCoordY(int y,int r,int angle)
{
return y + r * sin(angle);
}
Sin and cos functions in cmath/math.h use radians, not degrees.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks