I've been trying to generate a pattern of circles using a for loop. However, when it runs everything looks fine except for the 9th ring of circles which is ever so slightly. Having looked at a print out of numbers for that circle everything looks fine, so I can't work out what is going wrong. However, when I add one to the angle value of that ring. i.e. j (the commented out code) it pretty much corrects.
Any idea why this might happen. having looked at all the numbers I can only think it is some math error that I haven't factored in or am I missing something obvious.
Thanks!
ellipse(325,325,15,15);
float div = 1;
for (int i = i; i < 25; i++)
{
div = i*6
float segment = 360/div;
float radius = (i*20);
for (int j = 0; j < 360; j+=segment)
{
//if (i==8)
//{
//println("before " + j);
//j+=1;
//println("after " + j);
//}
float x = 325 + (radius*cos(radians(j)));
float y = 325 + (radius*sin(radians(j)));
ellipse(x, y, 15, 15);
}
}