Archimedean spiral in C++ 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 &lt; 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.
Figured it out :) The dominos are now being placed along the X and Y coordinates generated by the function. 

The original code in the question was plotting a wave of points outwards from the centre position or origin and was not what I wanted. What I needed was for each point to follow the Archimedean spiral with a certain space between the spirals. 

Initially I used integer values to store the x and y coordinates but this was causing a precision error by truncating the floating point value in order to store it in the integer data type.

The below example generates points along the spiral continuously, relative to the maxPoints value. 

float x = 0;
float y = 0;
float angle = 0.0f;

// Space between the spirals
int a = 2, b = 2;

for (int i = 0; i &lt; maxPoints; i++)
{
    angle = 0.1 * i;
    x = (a + b * angle) * cos(angle);
    y = (a + b * angle) * sin(angle);

    plot(x, y);
}


Code for the project is on GitHub, you will need Bullet and freeglut