我不确定这个问题与哪个领域相关,但我会试一试。我在试着计算Mandelbrot集。最大的区别是我的输出是一个3D模型。集合的计算是精确完成的,但一旦我试图缩放到x,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; 编辑:我看了你给我的一些例子,但我仍然没有找到最适合我的答案。
发布于 2011-11-28 05:22:27
好吧,我设法找到了正确的解决方案。由于轴都恢复了,所以我写了以下内容:
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;https://stackoverflow.com/questions/8245943
复制相似问题