1

我不确定这个问题与哪个领域相关,但我会试一试。我正在尝试计算 Mandelbrot 集。最大的不同是我的输出是 3D 模型。该集合的计算是精确完成的,但是一旦我尝试缩放到 ax,y 点(位于 2D 平面上),它就无法按预期工作。这里的主要概念是通过提取下一个缩放点,我将能够计算我的集合的新边界边缘。什么时候

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)

结果是缩放到未知点。我猜计算有问题。我试图做以下事情:

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; 

编辑:我回顾了你给我的一些例子,但我仍然没有找到最适合我情况的合适答案。

4

1 回答 1

1

好吧,我设法找到了正确的解决方案。由于轴都被还原,我写了以下内容:

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;
于 2011-11-27T21:22:27.107 回答