【问题标题】:Mandelbrot zooming difficultyMandelbrot 缩放难度
【发布时间】:2011-11-23 16:46:54
【问题描述】:

我不确定这个问题与哪个领域相关,但我会试一试。 我正在尝试计算 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; 

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

【问题讨论】:

  • 为什么是 foundPointOnHost.z 而不是 foundPointOnHost.y
  • 您发布了您的实际代码吗?似乎有多余的';'展示。并不是说这会导致您的问题(很可能),但请确保向我们展示您的实际代码。
  • 这与 OpenGL 和/或 CUDA 有什么关系?
  • stackoverflow 中有一些与此主题相关的问题:如何缩放 mandelbrot 集,如何放大我的代码 (mandelbrot),Mandelbrot 在 C 中实现缩放,如何“放大” Mandelbrot 集的一部分?,如何放大 mandelbrot 集? ...
  • 嘿。 Y 值代表高度,当 X 和 Z 的值代表实际的绳索系统时。整个系统使用 CUDA 并行计算,然后使用 OPENGL 显示。使用 XY 线系统时有一个已知的答案(我试图调整到我的解决方案,但由于某种原因它不起作用)

标签: opengl graphics cuda fractals mandelbrot


【解决方案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;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多