使用 Asymptote 绘制 3D 图形

使用 Asymptote 绘制 3D 图形

我最近开始学习 Asymptote 来为我的 TeX 相关文档生成图表,并且一直在使用https://asymptote.sourceforge.io/asymptote_tutorial.pdf掌握代码。虽然我使用 2D 绘图功能时感到非常高兴(和幸运!),但我无法运行简单的 3D 代码:

settings.outformat = "pdf";
settings.prc = false;
size(5cm,0);
import three;
draw(unitsphere);

在上述教程 (p.51) 中提到过。具体来说,在命令提示符环境中对代码运行“asy.exe”时,我得到:

D:\Test_Asy>asy test3d.asy
    shipout3(prefix,f,preview ? nativeformat() : format,
            ^
C:/texlive/2021/texmf-dist\asymptote/three.asy: 2878.13: runtime:       2 [main] asy 11464 cygwin_exception::open_stackdumpfile: Dumping stack trace to asy.exe.stackdump
C:\texlive\2021\bin\win32\runscript.tlu:915: command failed with exit code 34816:
asy test3d.asy

PS 我不知道这是否相关,生成的转储(D:\Test_Asy\asy.exe.stackdump)如下:

Exception: STATUS_FLOAT_INVALID_OPERATION at rip=7FFACAA4312F
rax=7FFFFFFFFFFFFF00 rbx=000000000CFA43A0 rcx=7FF0000000000000
rdx=0000000000000000 rsi=0000000000000001 rdi=000000000000000D
r8 =0000000000000508 r9 =000000000C0EA060 r10=00000100000001B3
r11=06BCA1AF286BCA1B r12=0000000000000068 r13=0000000000000000
r14=00000000FFFF44A0 r15=0000000000000000
rbp=0000000000000000 rsp=00000000FFFF4250
program=C:\texlive\2021\tlpkg\asymptote64\asy.exe, pid 11464, thread main
cs=0033 ds=002B es=002B fs=0053 gs=002B ss=002B
Stack trace:
Frame        Function    Args
00000000000  7FFACAA4312F (000FFFF4400, 0000000000D, 0000000000D, 00000000096)
000FFFF44C0  7FFACAA5073B (000FFFF4401, 00000000300, 0000BF6E3B0, 000FFFF4400)
000FFFF44C0  7FFACAA4B2AF (00000000000, 00000000000, 00000000001, 00000000000)
000FFFF4870  7FFACAA40D4A (0000AE14300, 000FFFF52A0, 00000000494, 00000000018)
000FFFF52A0  7FFACA9E3B00 (000FFFF5670, 0000C0EC0A0, 000FFFF5600, 000FFFF5670)
000FFFF5600  7FFACA9102B3 (00000000000, 000FFFF5670, 0000C0EC0A0, 0000000000F)
000FFFF5600  7FFACA911AF4 (7FFACB61C400, 000FFFF5670, 0000C0EC0A0, 0000AE0CB20)
000FFFF5C90  7FFACA90E154 (000FFFF5C90, 0000AE0CB20, 000FFFF5709, 0000AE0CB20)
000FFFF5C90  7FFACA8A2AFF (0000BF6E530, 0000BF6DD10, 00000000000, 0000CC388D0)
000FFFF5C90  7FFACA92745B (7FFACA88A42A, 00000000000, 000FFFF9070, 00000000000)
000FFFF5F10  7FFACA7C0F8C (0000BD94B08, 0000BEF6830, 00000000000, 0000BDF7F01)
000FFFF63E0  7FFACA78E8FF (0000BD94B08, 00000000000, 0000BDE2890, 000FFFF6A10)
00000000000  7FFACB04EBF9 (0000BD8BD70, 0000BD6EB00, 00000000000, 0000BED3820)
0000BED3820  7FFACB04ED83 (0000BD6ECE0, 000FFFF6B79, 0000BD65801, 000FFFF6B50)
000FFFF6B79  7FFACB04EF8D (0000BD65B01, 00000000000, 7FFA0000000A, 00000000000)
00000000000  7FFACB04E9A0 (000FFFF6D20, 00000000000, 000FFFF9070, 00000000000)
End of stack trace (more stack frames may be present)

答案1

这可能是由于您的图形库(或卡)中的错误造成的。以下是一些可以尝试的方法(我尚未在 Windows 下测试完整的 TL 2021 安装,只测试了我提交的可执行文件):

  1. 删除现在(大部分)已过时的行 settings.outformat = "pdf"; settings.prc = false; 您是否获得了 OpenGL 图像?按下 e 键时会发生什么?

  2. 尝试添加行 settings.outformat="html"; 您是否获得了 WebGL 图像?

  3. 直接从安装 asyhttps://asymptote.sourceforge.io/

相关内容