我在Asymptote 学习记录(3) 画赵爽弦图练习 里画了赵爽弦图,不过方法比较笨.下面用旋转和平移画出那四个三角形.得到的图像和Asymptote 学习记录(3) 画赵爽弦图练习 里的图像一样.在桌面建立test.asy文档,文档内容如下:
1 import settings; 2 settings.tex = "pdflatex"; 3 pdfviewer="/usr/bin/okular"; 4 outformat="pdf"; 5 size(400); 6 texpreamble("\usepackage{CJKutf8}\AtBeginDocument{\begin{CJK}{UTF8}{gbsn}}\AtEndDocument{\clearpage\end{CJK}}"); 7 import math; 8 add( scale(1cm) * grid(7, 7, heavygray) ); 9 add( shift(0,3cm) * rotate(-aTan(3/4)) * scale(1cm) * grid(5, 5, heavygray) ); 10 fill( box((3cm,3cm), (4cm,4cm)), opacity(0.3)+yellow ); 11 guide zhushi=((4cm,0)-- (4cm,3cm) -- (0,3cm) -- cycle); 12 filldraw (zhushi^^shift(7cm,0)*rotate(90)*zhushi^^shift(7cm,0)*rotate(90)*shift(7cm,0)*rotate(90)*zhushi^^shift(7cm,0)*rotate(90)*shift(7cm,0)*rotate(90)*shift(7cm,0)*rotate(90)*zhushi,fillpen=opacity(0.1)+red, drawpen=red+0.5mm); 13 label("朱实", (2cm,4cm),red); 14 label("黄实", (3.5cm,3.5cm),yellow); 15 label("弦实", (5cm,4cm),orange); 16 label( Label("勾三",Rotate(S)), (4cm,0)--(4cm,3cm), LeftSide ); 17 label( Label("股四",Rotate(E)), (4cm,3cm)--(0,3cm), LeftSide ); 18 label( Label("弦五",Rotate((4,-3))), (0,3cm)--(4cm,0), LeftSide );
然后在终端里输入asy -V -f pdf ~/Desktop/test 即可生成图像.