无论是在交互模式下运行还是从 pdflatex 运行,Asymptote 都会生成不同的输出

无论是在交互模式下运行还是从 pdflatex 运行,Asymptote 都会生成不同的输出

我想制作 3D 图片并将它们并排放置。我可以通过创建一个文件来完美地做到这一点example.asy

settings.render=1;
import graph;
import graph3;
import contour3;

material reds =  material(diffusepen=0.7red,ambientpen=red,emissivepen=0.3*red,specularpen=0.95white,shininess=0.95);
material blues = material(diffusepen=0.7blue,ambientpen=blue,emissivepen=0.3*blue,specularpen=0.95white,shininess=0.95);

int numberlines=8;

defaultrender.merge=true;
defaultrender.tessellate=true;
defaultrender.compression=Low;

picture p1,p2;
size(p1,100);
size(p2,100);

real f(real x, real y, real z) {return y^2+x-2;}
real c(real x, real y, real z) {return 2*x+2*z -2;}

draw(p1,surface(contour3(f,(-3,-3,-3),(3,3,3),numberlines)),reds);
draw(p1,surface(contour3(c,(-3,-3,-3),(3,3,3),numberlines)),blues);
draw(p2,surface(contour3(f,(-3,-3,-3),(3,3,3),numberlines)),reds);
draw(p2,surface(contour3(c,(-3,-3,-3),(3,3,3),numberlines)),blues);

currentprojection=orthographic(camera=(9,10,4),up=Z,target=O,zoom=1);
add(p2.fit(currentprojection),(0,0),W);
currentprojection=orthographic(camera=(0,7,7),up=Z,target=O,zoom=1);
add(p1.fit(currentprojection),(0,0),30E);

结果是从两个不同的角度看到的相同的 3D 图像: 在此处输入图片描述

但是,如果我尝试在 LaTeX 文档中重现该图像,我会得到第二张图像的两个重复副本(在本例中是相机在 (0,7,7) 处的投影): 在此处输入图片描述

这是我正在使用的 LaTeX 代码:

\documentclass{article}

\usepackage[inline]{asymptote}

\begin{asydef}
settings.outformat="png";
settings.render=1;
import graph;
import graph3;
import contour3;

material reds =  material(diffusepen=0.7red,ambientpen=red,emissivepen=0.3*red,specularpen=0.95white,shininess=0.95);
material blues = material(diffusepen=0.7blue,ambientpen=blue,emissivepen=0.3*blue,specularpen=0.95white,shininess=0.95);

int numberlines=8;

defaultrender.merge=true;
defaultrender.tessellate=true;
defaultrender.compression=Low;
\end{asydef}

\begin{document}
\begin{asy}
    picture p1,p2;
    size(p1,100);
    size(p2,100);

    real f(real x, real y, real z) {return y^2+x-2;}
    real c(real x, real y, real z) {return 2*x+2*z -2;}

    draw(p1,surface(contour3(f,(-3,-3,-3),(3,3,3),numberlines)),reds);
    draw(p1,surface(contour3(c,(-3,-3,-3),(3,3,3),numberlines)),blues);
    draw(p2,surface(contour3(f,(-3,-3,-3),(3,3,3),numberlines)),reds);
    draw(p2,surface(contour3(c,(-3,-3,-3),(3,3,3),numberlines)),blues);

    currentprojection=orthographic(camera=(9,10,4),up=Z,target=O,zoom=1);
    add(p2.fit(currentprojection),(0,0),W);
    currentprojection=orthographic(camera=(0,7,7),up=Z,target=O,zoom=1);
    add(p1.fit(currentprojection),(0,0),30E);
\end{asy}
\end{document}

这是渐近线 2.15.2。

如何从 LaTeX 获取与asy -V从命令行运行相同的输出?

相关内容