分形/xaos
XaoS 是一个用 C++ 和 JS 编写的交互式分形缩放程序。它允许用户实时连续放大或缩小分形。
这里是非官方的 XaoS wiki。
XaoS 最初只是一个“写得不好的”Mandelbrot 浏览器[1],直到 Jan Hubička 添加了高效缩放(= 实时缩放[2])[3],使用了一种有时称为 XaoS 算法或 Hubička 算法的技术。
当时,分形缩放电影是通过完全重新计算每一帧来制作的,即使它们自然地与彼此共享大部分区域。这使得在没有非常强大的计算机的情况下,交互式缩放成为不可能。[4] 此外,除非使用更多处理来进行抗锯齿,否则重新计算每一帧会产生“闪烁”效果,因为小的明亮区域会在像素之间出现然后消失。[5]
然而,允许用户缩放,而不是像Fractint那样跳跃,似乎是与分形交互最自然的方式。为了创建一个交互式缩放,Hubička 需要找到一种方法来保存已经完成的计算。保存每个计算过的像素会占用太多内存,因此 Hubička 算法只保存上一帧,而不是记住每个像素的位置,它可以将它们对齐成行和列并记住它们。
XaoS 算法中最困难的部分是选择将保存的行和列绘制在哪里。这样做错误会导致图像失真,但必须快速完成才能有用。在尝试了几种不同的启发式方法之后,最终将这个问题视为一个优化问题。
剩余的行和列的颜色与最接近的行/列相同,并在CPU有时间这样做时被重新计算。这在保持缩放进行和提高细节水平之间取得了平衡。计算图像正在缩放到的区域的优先级更高,因为这些区域将在屏幕上停留时间最长,而且这很可能是用户正在查看的地方。缩小,则相反,优先级在边缘。[5]
Hubička 算法也可以应用于放大其他像素是计算出来的图像,并且已在其他软件中使用,例如 rtzme 复函数绘图程序[6],以及其他分形缩放器。
要找到它,使用
xaos -help
输出是
XaoS3.5 help text
(This help is genereated automagically. I am sorry for all inconvencies)
option string param description
-delay number
Delay screen updates (milliseconds)
-driver string
Select driver
-list List available drivers. Then exit
-config Print configuration. Then exit
-speedtest Test speed of calculation loop. Then exit
-threads number
Set number of threads (CPUs) to use
-pipe string
Accept commands from pipe (use "-" for stdin)
-maxframerate number
Maximal framerate (0 for unlimited - default)
Screen size options:
Knowledge of exact screen size makes random dot stereogram look better.
Also is used for choosing correct view area
-screenwidth f.point
exact size of screen in centimeters
-screenheight f.point
exact size of screen in centimeters
Use this option in case you use some kind of virtual screen
or something similar that confuses previous options
-pixelwidth f.point
exact size of one pixel in centimeters
-pixelheight f.point
exact size of one pixel in centimeters
-formula string
user formula
-forminit string
z0 for user formula
Animation rendering:
-render string
Render animation into seqence of .png files
-basename string
Name for .png files (XaoS will add 4 digit number and extension
-size string
widthxheight
-renderimage string
256 or truecolor
-renderframerate f.point
framerate
-antialiasing Perform antialiasing (slow, requires quite lot of memory)
-alwaysrecalc Always recalculate whole image (slowes down rendering, increases quality)
-rendervectors Render motion vectors (should be used for MPEG encoding)
-iframedist number
Recommended distance between I frames in pat file (should be used for MPEG encoding)
X11 driver options:
-display string
Select display
-size string
Select size of window (WIDTHxHEIGHT).
-sync Generate sync signals before looking for events. This
helps on old and buggy HP-UX X servers.
-shared Use shared colormap on pseudocolor display.
-usedefault Use default visual if autodetection causes troubles.
-nomitshm Disable MITSHM extension.
-fullscreen Enable fullscreen mode.
-windowid number
Use selected window.
-window-id number
Use selected window.
-root Use root window.
AA driver options:
-aadriver string
Select display driver used by aa-lib
-kbddriver string
Select keyboard driver used by aa-lib
-mousedriver string
Select keyboard driver used by aa-lib
-font string
Select font
-width number
Set width
-height number
Set height
-minwidth number
Set minimal allowed width
-minheight number
Set minimal allowed height
-maxwidth number
Set maximal allowed width
-maxheight number
Set maximal allowed height
-recwidth number
Set recommended width
-recheight number
Set recommended height
-normal enable usage of narmal{{typo help inline|reason=similar to harmal|date=September 2022}} characters
-nonnormal disable usage of normal characters
-dim enable usage of dim(half bright) characters
-nodim disable usage of dim(half bright) characters
-bold enable usage of bold(double bright) characters
-nobold disable usage of bold(double bright) characters
-boldfont enable usage of boldfont characters
-noboldfont disable usage of boldfont characters
-reverse enable usage of reversed characters
-noreverse disable usage of reversed characters
-all enable usage of reserved characters
-eight enable usage of non ansi characters
-extended enable usage of extended character set
-inverse enable inverse
-bright number
set bright (0-255)
-contrast number
set contrast (0-255)
-gamma f.point
set famma (0-1)
-nodither Disable dithering
-floyd_steinberg Enable floyd steinberg dithering
-error_distribution Enable error distribution dithering
-random number
Set random dithering value
-dimmul f.point
Multiply factor for dim color (5.3)
-boldmul f.point
Multiply factor for bold color (5.3)
-nomouse Disable mouse
Command line options only
-print_menus print menus specifications of all menus
-print_menu string
print menu specification
-xshl_print_menustring
print menu specification in xshl format
-xshl_print_menus print all menu specifications in xshl format
-print_dialog string
print dialog specification
File
-loadpos input_file
Load
-savepos output_file
Save
-record output_file
Record
-play input_file
Replay
-saveimg output_file
Save image
-loadexample Load random example
-savecfg Save configuration
Fractal
-usrform string
User formula
-usrformInit string
User initialization
-perturbation real_number real_number
Perturbation
-initstate Reset to defaults
-julia on|off
Julia mode
-view real_number real_number real_number real_number
View
-angle real_number
Set angle
-plane integer
Set plane
-incoloring integer
Inside coloring mode
-outcoloring integer
Outside coloring mode
-intcoloring integer
Inside truecolor coloring mode
-outtcoloring integer
Outside truecolor coloring mode
-juliaseed real_number real_number
Julia seed
Calculation
-periodicity Periodicity checking
-maxiter integer
Iterations
-bailout real_number
Bailout
-fastjulia Fast julia mode
-range integer
Solid guessing range
Filters
-edge Edge detection
-edge2 Edge detection2
-threed Pseudo 3d
-starfield Starfield
-stereogram Random dot stereogram
-interlace Interlace filter
-blur Motionblur
-emboss Emboss
-palettef Palette emulator
-anti Antialiasing
-truecolor Truecolor emulator
UI
-letterspersec integer
Letters per second
-autopilot Autopilot
-inhibittextoutput VJ mode
-recalculate Recalculate
-interrupt Interrupt
-speed real_number
Zooming speed
-fixedstep Fixed step
-nogui Disable XaoS's builtin GUI
-status Status
-ministatus Ministatus
Misc
-playstr string
Play string
-text string
Display text
-color white|black|red
Color
-textposition left|center|right top|middle|bottom
Text position
-message string
Message
Help
-help Help
Formulae
-mandel Mandelbrot
-mandel3 Mandelbrot^3
-mandel4 Mandelbrot^4
-mandel5 Mandelbrot^5
-mandel6 Mandelbrot^6
-newton Newton
-newton4 Newton^4
-barnsley Barnsley1
-barnsley2 Barnsley2
-barnsley3 Barnsley3
-octal Octal
-phoenix Phoenix
-magnet Magnet
-magnet2 Magnet2
More formulae
-trice Triceratops
-catseye Catseye
-mbar Mandelbar
-mlambda Lambda
-manowar Manowar
-spider Spider
-sier Sierpinski
-carpet S.Carpet
-koch Koch Snowflake
-hornflake Spidron hornflake
-user User defined
Palette
-defpalette Default palette
-randompalette Random palette
-palette integer integer integer
Custom palette
-cycling Color cycling
-cyclingspeed integer
Color cycling speed
-shiftpalette integer
Shift palette
Dynamic resolution
-fastmode zero|never|animation|new|allways
Dynamic resolution mode
Rotation
-rotationspeed real_number
Rotation speed
-autorotate on|off
Automatic rotation
-fastrotate on|off
Fast rotation mode
Quit
-quit Exit now
Xaos 动画文件 (*.xaf ) 是一个包含用于生成图像序列的函数的文件
例如
xaos-3.5/tutorial/julia.xaf
要创建 xaf 文件,请使用记录功能,语法
(record bool [ file ])
示例
(record #t)
或
(record #f)
如何从 xaf 文件渲染图像序列
xaos -render [xpf_filename] -size 352x240 -antialiasing -renderframerate 24 -basename [basename]
xpf 代表 **Xaos 位置文件**。该文件是人类可读的,并且可以在保存后轻松地手动改进,或者用作动画的基础。[7]
例如,请参见
标准视图(无缩放的 Mandelbrot 集 = 图像)
;Position file automatically generated by XaoS 3.5 ; - a real-time interactive fractal zoomer ;Use xaos -load <filename> to display it (initstate) (defaultpalette 0) (formula 'mandel) (view -0.75 0 2.5 2.5)
当我们切换到 Julia 模式(禁用 Mandelbrot 模式)时
(initstate) (defaultpalette 0) (formula 'mandel) (julia #t) (view -0.75 0 2.5 2.5)
或将 c 值(= **Julia 种子**)从 c=0 更改为 c= -1
(initstate) (defaultpalette 0) (formula 'mandel) (juliaseed -1 0) (julia #t) (view -0.8434 0.07535 2.744 2.744)
或显示平面值(默认 = 0 不显示)
(initstate) (defaultpalette 0) (formula 'mandel) (juliaseed -1 0) (julia #t) (plane 0) (view -0.9127 -0.09268 2.285 2.285)
minibrot.xpf
(initstate) (palette 1 860134713 0) (formula 'mandel) (outcoloring 1) (view -1.9854567 -1.351727E-05 0.00029196024 0.00029196024)
其中视图[8] 描述了 视窗(平面的矩形部分)
view float float float float view centerRe centerIm radius angle
xpf 文件列表
- 由 Chris Gray 分类 由 Chris Gray 使用 xpf 文件计算的一些分形
为了描述 平面(视图),Xaos 使用
- 脚本中的 4 个数字
- 菜单中的 3 个数字
Xaos 用“半径”来称呼它,但它被定义为:” (x2-x1= 宽度) 和 y2-y1= 高度 的较大值。“ 这就是为什么在 Xaos 中可以将半径设置为 2/缩放的原因。
要使用 **菜单** 在 Xaos 中设置相同的视点,请设置 3 个数字来定义圆形
- 中心的实部为 (x1+x2)/2
- 中心的虚部为 (y1+y2)/2
- “半径” = x2-x1 和 y2-y1 的较大值。
其中,可见点的左上角和右下角的坐标,指定坐标为四个数字 x1、y1、x2、y2。
在 **xpf 文件** 中,平面可以用 4 个浮点数描述:[9]
- 中心的实部
- 中心的虚部
- 世界坐标系中的宽度 = x2-x1,称为“实际半径”。
- 世界坐标系中的高度 = y2-y1,称为“虚半径”。
语法
(view float float float float)
示例
(view -0.75 0 2.5 2.5)
"People specify fractal coordinates in many ways. Some people use the coordinates of the upper-left and lower-right visible points, specifying the coordinates as four numbers x1, y1, x2, y2. To set the same viewpoint in XaoS, set the real portion of the center to (x1+x2)/2, the imaginary part of center to (y1+y2)/2, and the radius to the greater of x2-x1 and y2-y1. Other programs use a zoom factor instead of a radius. For these, you can set the radius to 2/zoom."[10]
" ... lets you specify an ellipse instead of a circle. You can specify both a real and an imaginary radius "
(initstate) (defaultpalette 0) (formula 'user) (usrform "Z^2+C") (usrformInit "") (view -0.4641 0.01977 2.444 2.444)
(bailout 6)
逃逸值或逃逸半径。Xaos 在这里使用逃逸半径的平方,所以如果你想要逃逸值为 2,在这里输入 2*2 = 4。
语法:[11]
(formula keyword)
示例
(formula mandel)
| 名称 | 描述 | 教程 | 用户公式 |
|---|---|---|---|
| mandel | 标准曼德勃罗集或朱利亚集。 | mset.xaf | Z^2+C |
| mandel3 | 示例 | power.xaf | Z^3+C |
| mandel4 | 示例 | power.xaf | Z^4+C |
| mandel5 | 示例 | power.xaf | Z^5+C |
| mandel6 | 示例 | power.xaf | Z^6+C |
| newton | 这是牛顿求解多项式根的近似方法。它使用多项式 x^3=1 | newton.xaf | |
| barnsley | 示例 | 示例 | 示例 |
| octo | 示例 | 示例 | 示例 |
| phenix | 示例 | 示例 | 示例 |
| magnet | |||
| trice |
更改命名公式(菜单/分形/公式)不会更改用户公式!!!
语法
(plane integer)
允许的值:[12]
| 值 | 名称 | 描述 |
|---|---|---|
| 0 | mu | 普通复平面(默认) |
| 1 | 1/mu | 反演:旧的无穷大现在在 0,而旧的 0 现在在无穷大。 |
| 2 | 1/(mu+0.25) | 类似于反演,但也会将中心移到曼德勃罗集之外,使其看起来像抛物线。 |
| 3 | lambda | lambda 平面 |
| 4 | 1/lambda | lambda 平面的反演 |
| 5 | 1/(lambda-1) | 具有移动中心的反演 |
| 6 | 1/(mu-1.40115) | 具有移动中心的反演 |
// from xaos-3.5\src\engine\plane.c
/*
* XaoS, a fast portable realtime fractal zoomer
* Copyright (C) 1996,1997 by
*
* Jan Hubicka (hubicka@paru.cas.cz)
* Thomas Marsh (tmarsh@austin.ibm.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
CONST char *CONST planename[] = {
"mu",
"1/mu",
"1/(mu+0.25)",
"lambda",
"1/lambda",
"1/(lambda-1)",
"1/(mu-1.40115)",
NULL
};
// include/complex.h:57:
// #define myabs(x) ((x)>0?(x):-(x))
REGISTERS(3)
void recalculate(int plane, number_t * x1, number_t * y1)
{
number_t x = *x1, y = *y1;
switch (plane) {
case 1:
{ /* 1/mu */
number_t t;
if (myabs(x) + myabs(y) < 0.000001)
t = INT_MAX, y = INT_MAX;
else {
c_div(1, 0, x, y, t, y);
}
x = t;
}
break;
case 2:
{ /* 1/(mu + 0.25) */
number_t t;
if (myabs(x) + myabs(y) < 0.000001)
t = INT_MAX, y = INT_MAX;
else {
c_div(1, 0, x, y, t, y);
}
x = t;
x += 0.25;
}
break;
case 3: /* lambda */
{
number_t tr, ti, mr, mi;
mr = x, mi = y;
c_pow2(x, y, tr, ti);
c_div(tr, ti, 4, 0, x, y);
c_div(mr, mi, 2, 0, tr, ti);
c_sub(tr, ti, x, y, mr, mi);
x = mr, y = mi;
}
break;
case 4: /* 1/lambda */
{
number_t tr, ti, mr, mi;
c_div(1, 0, x, y, tr, y);
x = tr;
mr = x, mi = y;
c_pow2(x, y, tr, ti);
c_div(tr, ti, 4, 0, x, y);
c_div(mr, mi, 2, 0, tr, ti);
c_sub(tr, ti, x, y, mr, mi);
x = mr, y = mi;
}
break;
case 5: /* 1/(lambda-1) */
{
number_t tr, ti, mr, mi;
c_div(1, 0, x, y, tr, y);
x = tr + 1;
mr = x, mi = y;
c_pow2(x, y, tr, ti);
c_div(tr, ti, 4, 0, x, y);
c_div(mr, mi, 2, 0, tr, ti);
c_sub(tr, ti, x, y, mr, mi);
x = mr, y = mi;
}
break;
case 6:
{ /* 1/(mu + 0.25) */
number_t t;
if (myabs(x) + myabs(y) < 0.000001)
t = INT_MAX, y = INT_MAX;
else {
c_div(1, 0, x, y, t, y);
}
x = t;
x -= 1.40115;
}
break;
default:
break;
}
*x1 = x;
*y1 = y;
}
它更改了轨道开始的点。传统上使用零。[13]
(perturbation complex)
info xaosdev.info
这并不简单。[14] 可以使用以下方法:
XaoS -render fractal.xpf -size 18000x12000
"XaoS 通常以低分辨率(约 320x200)启动,以加快计算速度。如果您有快速的计算机或需要保存更大的 .gif 图像,您可以更改分辨率。这可以通过在全屏驱动程序中按 '=' 或简单地调整 XaoS 窗口大小来完成。" [17]
- 使用 xpf 文件
- 使用主菜单/分形/用户公式
- 添加内置公式[18]
- 编辑 src/engine/formulas.c 中的源代码
#define VARIABLES register number_t n,sqrr,sqri,zre1,zim1;
#define INIT sqri=zim*zim,n=zre,zre=pre,pre=n,n=zim,zim=pim,pim=n,n=(number_t)1;
#define BTEST greater_then_1Em6(n)
#define FORMULA \
zre1 = zre; \
zim1 = zim; \
n = zim * zim; \
sqri = zre * zre; \
sqrr = sqri - n; \
sqri = n + sqri; \
n = 0.3333333333 / ((sqri * sqri)); \
zim = (0.66666666) * zim - (zre + zre) * zim * n + pim; \
zre = (0.66666666) * zre + (sqrr) * n + pre; \
zre1 -= zre; \
zim1 -= zim; \
n = zre1 * zre1 + zim1 * zim1;
#define CALC newton_calc
#include "docalc.c"
修改代码后,您必须重新编译 XaoS 才能生效。[19]
- ↑ XaoS 手册页
- ↑ 由 Zoltán Kovács 编写的实时缩放数学引擎
- ↑ xaosdev.info:算法
- ↑ CS and Dance (PDF), archived from the original on 2005-12-20
- ↑ a b Hubička, Jan (1997), XaoS 算法, archived from the original on 2014-03-28.
- ↑ 复平面的可视化, archived from the original on 2006-10-17
- ↑ Xaos 格式说明
- ↑ Xaos - 视图
- ↑ Xaos - 平面说明
- ↑ Xaos - 视图
- ↑ Xaos 文档 - 公式
- ↑ GNU XaoS » 文档 » XaoS » 平面
- ↑ Xaos 文档 - 扰动
- ↑ 无法(轻松)渲染高分辨率静态图像 #53
- ↑ xaos-users 论坛:分辨率
- ↑ xaos-users 论坛:Mac OSX 上的更高分辨率
- ↑ Xaos 教程
- ↑ Xaos 文档:由阿帕德·费凯特添加内置公式
- ↑ xaos-users 论坛:牛顿分形