im calculating mandelbrot set, with the ability of zooming and printing it to the screen using OpenGL.
as you know mandelbrot set is defined by a rectangle(top right point and bottom left point) and every time i 'zoom in' and 'zoom out' i change the following points by moving the bottom left point to the upper right side and the top right point vice versa. eventually those 2 points are supposed to meet each other and finish the zooming process.
according to many YOUTUBE movies i can see clearly that some movies allow you to reach to 1000X zoom. when in my program i can hardly reach to X6. while debugging i can see my 2 points, which define the mandelbrot set reach each other (x1,y1) = (x2,y2)
.
few things :
(x1,y1) & (x2,y2)
are defined as floats. should i use double instead ?
my mandelbrot is defined by (512X512) points. is that enough? though im not sure it's connected to the problem.
another problem i;m facing is that - im printing the set as an height map(3D set). when each Y component representes the amount of iterations it took a certain point to reach infinity. however each time i zoom in the entire set goes upper and upper to the my camera's positions and eventually my camera is consumed by the set. is there a way to calculate the difference and move the camera away from the set(from the zooming point accordingly?)
the code that calcs the set :
double ratiox = instance->foundPointOnHost.x / ((instance->constVal[1][0] - instance->constVal[0][0]));;
double ratioy = 1-instance->foundPointOnHost.z / ((instance->constVal[1][1] - instance->constVal[0][1]));;
double xrange = instance->m_GraphConfig.xru-instance->m_GraphConfig.xld;
double yrange = instance->m_GraphConfig.yru-instance->m_GraphConfig.yld;
instance->m_GraphConfig.xld += 5*direction*0.005*ratiox*xrange;
instance->m_GraphConfig.xru -= 5*direction*0.005*(1.-ratiox)*xrange;
instance->m_GraphConfig.yld += 5*direction*0.005*(1.-ratioy)*yrange;
instance->m_GraphConfig.yru -= 5*direction*0.005*ratioy*yrange;
few things :
instance->FoundPointOnHost = the point i want to zoom in.
instance->constVal = contains the original size of the set (in the begining equals to [xru,yru] [xld,yld])
(xru,yru) = top right points of the set
(xld,yld) = bottom left points of the set
thanks!