第563行: |
第563行: |
| [[File:P67Mandelbrot_sequence_new_still.png|300px|thumb|right|放大倍数增大后的动态视频截图]] | | [[File:P67Mandelbrot_sequence_new_still.png|300px|thumb|right|放大倍数增大后的动态视频截图]] |
| | | |
| + | 可以利用多种算法通过计算设备来绘制曼德布洛特集。在这里,展示应用最广泛且最简单的算法:即朴素的“逃逸时间算法”。在逃逸算法中,对于绘图区域中每一个(x,y)点重复计算,根据计算后的不同表现为某一像素区域选择不同的颜色。每个点(x,y)用作重复计算或迭代计算中的起始值(下面将详细描述)。 每次迭代的结果用作下一次迭代的起始值。在每次迭代期间都会检测这些值,以查看它们是否已经达到了关键的“逃逸”条件或“跳出”条件。 如果达到该条件,则停止计算,选择像素的颜色并绘制,并检测下一个(x,y)点。每个点的颜色值反应了逃逸点处的逃逸速度。通常,黑色用于显示在迭代限制之前未能逃逸的值,而逐渐逃逸的点使用较亮的颜色表示。这很直观的表示了在达到逃逸条件之前需要多少个循环。 |
| | | |
− | There exist a multitude of various algorithms for plotting the Mandelbrot set via a computing device. Here, the most widely used and simplest algorithm will be demonstrated, namely, the naïve "escape time algorithm". In the escape time algorithm, a repeating calculation is performed for each x, y point in the plot area and based on the behavior of that calculation, a color is chosen for that pixel.
| |
− | 可以利用多种算法通过计算设备来绘制曼德布洛特集。在这里,展示应用最广泛且最简单的算法:即朴素的“逃逸时间算法”。
| |
− | 在逃逸算法中,对于绘图区域中每一个(“x”,“y”)点重复计算,根据计算后的不同表现为某一像素区域选择不同的颜色。
| |
| | | |
− | The x and y locations of each point are used as starting values in a repeating, or iterating calculation (described in detail below). The result of each iteration is used as the starting values for the next. The values are checked during each iteration to see whether they have reached a critical "escape" condition, or "bailout". If that condition is reached, the calculation is stopped, the pixel is drawn, and the next x, y point is examined.
| |
− | 每个点(“x”,“y”)用作重复计算或迭代计算中的起始值(下面将详细描述)。 每次迭代的结果用作下一次迭代的起始值。在每次迭代期间都会检测这些值,以查看它们是否已经达到了关键的“逃逸”条件或“跳出”条件。 如果达到该条件,则停止计算,选择像素的颜色并绘制,并检测下一个(“x”,“y”)点。
| |
− |
| |
− |
| |
− | The color of each point represents how quickly the values reached the escape point. Often black is used to show values that fail to escape before the iteration limit, and gradually brighter colors are used for points that escape. This gives a visual representation of how many cycles were required before reaching the escape condition.
| |
− | 每个点的颜色值反应了逃逸点处的逃逸速度。通常,黑色用于显示在迭代限制之前未能逃逸的值,而逐渐逃逸的点使用较亮的颜色表示。这很直观的表示了在达到逃逸条件之前需要多少个循环。
| |
− |
| |
− |
| |
− |
| |
− | To render such an image, the region of the complex plane we are considering is subdivided into a certain number of pixels. To color any such pixel, let {\displaystyle c} be the midpoint of that pixel. We now iterate the critical point 0 under {\displaystyle P_{c}}, checking at each step whether the orbit point has modulus larger than 2. When this is the case, we know that {\displaystyle c} does not belong to the Mandelbrot set, and we color our pixel according to the number of iterations used to find out. Otherwise, we keep iterating up to a fixed number of steps, after which we decide that our parameter is "probably" in the Mandelbrot set, or at least very close to it, and color the pixel black.
| |
| 为了渲染这样的图像,考虑将复平面区域分割成一定数量的点区域。要为任意点区域着色,设置<math>c</math>作为其点区域的中点。在<math> P_{c}</math>的前提下迭代临界点0,在每一步检查轨道点的模量是否大于2。(即<math>x^2+y^2</math>与<math>2^2</math>的关系)在这种情况下,我们知道<math>c</math>不属于曼德布洛特集。根据判断模量是否大于2所用的迭代次数为点区域着色。否则,我们将继续进行迭代直到遇到逃逸点,然后确定我们的参数“可能”在曼德布洛特集中,或者至少非常接近它,并将点区域涂成黑色。 | | 为了渲染这样的图像,考虑将复平面区域分割成一定数量的点区域。要为任意点区域着色,设置<math>c</math>作为其点区域的中点。在<math> P_{c}</math>的前提下迭代临界点0,在每一步检查轨道点的模量是否大于2。(即<math>x^2+y^2</math>与<math>2^2</math>的关系)在这种情况下,我们知道<math>c</math>不属于曼德布洛特集。根据判断模量是否大于2所用的迭代次数为点区域着色。否则,我们将继续进行迭代直到遇到逃逸点,然后确定我们的参数“可能”在曼德布洛特集中,或者至少非常接近它,并将点区域涂成黑色。 |
| | | |
− | --[[用户:趣木木|趣木木]]([[用户讨论:趣木木|讨论]])将像素译为点区域(可再讨论)
| |
− | --[[用户:木子二月鸟|木子二月鸟]]:我觉得可以,图片上的像素就是一个个点。
| |
| | | |
− |
| |
− | In pseudocode, this algorithm would look as follows. The algorithm does not use complex numbers and manually simulates complex-number operations using two real numbers, for those who do not have a complex data type. The program may be simplified if the programming language includes complex-data-type operations.
| |
| 在虚拟程序代码中,该算法如下所示。该算法不使用复数,对于那些没有复数类型的数据,使用两个实数手动对复数进行模拟。如果编程语言包含复杂数据类型的操作,则程序可以简化。 | | 在虚拟程序代码中,该算法如下所示。该算法不使用复数,对于那些没有复数类型的数据,使用两个实数手动对复数进行模拟。如果编程语言包含复杂数据类型的操作,则程序可以简化。 |
| | | |
− | | + | <source> |
| for each pixel (Px, Py) on the screen do | | for each pixel (Px, Py) on the screen do |
| x0 = scaled x coordinate of pixel (scaled to lie in the Mandelbrot X scale (-2.5, 1)) | | x0 = scaled x coordinate of pixel (scaled to lie in the Mandelbrot X scale (-2.5, 1)) |
第603行: |
第587行: |
| color := palette[iteration] | | color := palette[iteration] |
| plot(Px, Py, color) | | plot(Px, Py, color) |
| + | </source> |
| + | 其中,虚拟程序代码中的<math>c</math>, <math>z</math> 和<math>P_c</math>: |
| | | |
− | 这里,虚拟程序代码中的<math>c</math>, <math>z</math> 和<math>P_c</math>:
| |
| * <math>z = x + iy\ </math> | | * <math>z = x + iy\ </math> |
| * <math>z^2 = x^2 +i2xy - y^2\ </math> | | * <math>z^2 = x^2 +i2xy - y^2\ </math> |
| * <math>c = x_0 + i y_0\ </math> | | * <math>c = x_0 + i y_0\ </math> |
− | and so, as can be seen in the pseudocode in the computation of ''x'' and ''y'':
| + | |
| 因此,在计算“x”和“y”的虚拟程序代码中可以看出: | | 因此,在计算“x”和“y”的虚拟程序代码中可以看出: |
− | * <math>x = \mathop{\mathrm{Re}}(z^2+c) = x^2-y^2 + x_0</math> and <math>y = \mathop{\mathrm{Im}}(z^2+c) = 2xy + y_0.\ </math>
| + | |
| + | :<math>x = \mathop{\mathrm{Re}}(z^2+c) = x^2-y^2 + x_0</math> |
| + | :<math>y = \mathop{\mathrm{Im}}(z^2+c) = 2xy + y_0 </math> |
| | | |
| | | |