int MandelSetCount( double startx, double starty, int limit)
{
int count;
double x=startx, y=starty;
double newx, newy, funSq;
funSq = startx*startx + starty*starty;
for (count=0; count<limit && funSq<4.0; count++ )
{
newx = x*x - y*y + startx;
newy = 2.0*x*y + starty;
funSq = newx*newx + newy*newy;
x = newx; y = newy;
}
return count ;
}
Comments:
In this function, the value Ck is newx + j*newy;
the value Ck2 is funSq.