1

I'm not sure to which area this question is related , but I will give it a go. I'm trying to calculate the Mandelbrot set. The big difference is that my output is a 3D model. The set's calculation is done precisely, but once I try to zoom to a x,y point (which is located on the 2D plane) it doesn't work as expected. The main concept here is by the extract next zooming point, I will be able to calculate my set's new border edges. When

xru,yru = top right point of the set
xld yld = buttom left button
direction = 1 = zoom in
constVal = the original size of the set : 2X2
constVal[0] = xru , yru (at beginning)
constVal[1] = xld, yld (at beginning)

the result is zooming to unknown point. I guess that something is wrong with the calculation. I tried to do the following thing :

int direction = 1;
double ratiox = foundPointOnHost.x / ((constVal[1][0] - constVal[0][0]));
double ratioy = foundPointOnHost.z / ((constVal[1][1] - constVal[0][1]));
double xrange = xru-xld;
double yrange = yru-yld;

xld += direction*0.01*ratiox*xrange;
xru -= direction*0.01*(1.-ratiox)*xrange;
yld += direction*0.01*(1.-ratioy)*yrange;
yru -= direction*0.01*ratioy*yrange; 

EDIT : i reviewed some of the examples you gave me , but i still haven't found any suitable answer which fits best to my situation.

igal k
  • 1,883
  • 2
  • 28
  • 57
  • Why *foundPointOnHost.z* and not *foundPointOnHost.y*? – Brett Hale Nov 23 '11 at 16:51
  • 3
    Have you posted your actual code? There seem to be extra ';' present. Not that this causes your problems (most likely), but make sure you show us your actual code. – Bart Nov 23 '11 at 16:53
  • 2
    What does this have to do with OpenGL and/or CUDA? – genpfault Nov 23 '11 at 20:29
  • There are some question in stackoverflow related to this topic: how to zoom mandelbrot set, how to do zoom in my code (mandelbrot), Mandelbrot with zoom implementation in C, How to 'zoom' in on a section of the Mandelbrot set?, How do I zoom into the mandelbrot set? ... – pQB Nov 24 '11 at 10:26
  • Hey . Y value represents height , when values from X and Z represents the actuall cord system. the entire system is calculate parallel using CUDA and then displayed using OPENGL. there is a known answer when using a XY cord system (which i tried to adjust to my solution but it doesn't work for some reason ) – igal k Nov 24 '11 at 11:36
  • brat , that was the actual code ... my guess is that the compiler accepts double ';' – igal k Nov 25 '11 at 10:44
  • maybe i need to revert the axis? dont know what wrong with it... – igal k Nov 27 '11 at 16:01

1 Answers1

1

Well, I managed to find the right solution. Since the axis are all reverted, I wrote the following:

double ratiox = foundPointOnHost.x / (constVal[1][0] - constVal[0][0]);
double ratioy = 1-foundPointOnHost.z / (constVal[1][1] - constVal[0][1]);
double xrange = xru-xld;
double yrange = yru-yld;
hammar
  • 138,522
  • 17
  • 304
  • 385
igal k
  • 1,883
  • 2
  • 28
  • 57