Im trying to plot the x and y positions of an Archimedean spiral in C++.
So far I've been trying something like this, but no luck:
int dx = 0;
int dy = 0;
int x = 0;
int y = 0;
for (int i = 0; i < maxPoints; i++)
{
dx = sin(i * PI / 2);
dy = cos(-i * PI / 2);
x += dx;
y += dy;
plot(x, y);
}
EDIT: More info
I'm developing a 3D game application that demonstrates the use of the Bullet physics engine by simulating dominos. Instead of placing the dominos in the scene manually I want to use some math to do it for me :)
For anyone who is interested here it is on GitHub.
int
. In particular,dx
anddy
will probably get 0. $\endgroup$