初中時意外發現數學課本上有這麼一個好玩的圖
大概就是把兩條相等線段A、B分為10個小段並在點上標序號,A線段1點連B線段9點,2點連8點,依次類推。
假設有這麼一個框架圖
按照第一張圖的方式進一步繪圖
完整的tex檔案程式碼如下:
\documentclass{article} \usepackage{tikz} \usepackage{geometry} \pagestyle{empty} \geometry{a4paper,left = 0.1cm, right = 0.1cm, top = 4cm, bottom = 2.5cm} \begin{document} %----------------框架---------------- \begin{center} \begin{tikzpicture} \draw[->](0,0)--(10.5,0);%座標橫線 \draw[->](0,0)--(0,10.5);%座標縱線 \foreach\x in{1,...,10} { \draw(\x ,0.1cm)--(\x ,-0.1cm)node[anchor=north] {$\x$};%anchor表示方位 \draw(0.1cm,\x)--(-0.1cm,\x)node[anchor=east] {$\x$};%anchor表示方位 \draw(0,\x)--(10-\x,0); } \end{tikzpicture} \end{center}\par %----------------萬花圖框架---------------- \begin{center} \begin{tikzpicture}[scale=0.6] \draw(-10,0)--(10,0);%座標橫線 \draw(0,-10)--(0,10);%座標縱線 \draw(-7.07,-7.07)--(7.07,7.07);%正斜 \draw(7.07,-7.07)--(-7.07,7.07);%反斜 %外圈框架 \draw(0,10)--(7.07,10+7.07); \draw(7.07,7.07)--(10+7.07,7.07); \draw(10,0)--(10+7.07,-7.07); \draw(7.07,-7.07)--(7.07,-10-7.07); \draw(0,-10)--(-7.07,-10-7.07); \draw(-7.07,-7.07)--(-10-7.07,-7.07); \draw(-10,0)--(-10-7.07,7.07); \draw(-7.07,7.07)--(-7.07,7.07+10); \end{tikzpicture} \end{center}\par %----------------萬花圖---------------- \begin{center} \begin{tikzpicture}[scale=0.6] \draw(-10,0)--(10,0);%座標橫線 \draw(0,-10)--(0,10);%座標縱線 \draw(-7.07,-7.07)--(7.07,7.07);%正斜 \draw(7.07,-7.07)--(-7.07,7.07);%反斜 %外圈框架 \draw(0,10)--(7.07,10+7.07); \draw(7.07,7.07)--(10+7.07,7.07); \draw(10,0)--(10+7.07,-7.07); \draw(7.07,-7.07)--(7.07,-10-7.07); \draw(0,-10)--(-7.07,-10-7.07); \draw(-7.07,-7.07)--(-10-7.07,-7.07); \draw(-10,0)--(-10-7.07,7.07); \draw(-7.07,7.07)--(-7.07,7.07+10); \foreach\x in{1,...,9} { %內圈 \draw(0,\x)--(7.07-\x/1.41,7.07-\x/1.41); \draw(\x,0)--(7.07-\x/1.41,7.07-\x/1.41); \draw(0,-\x)--(7.07-\x/1.41,-7.07+\x/1.41); \draw(\x,0)--(7.07-\x/1.41,-7.07+\x/1.41); \draw(0,-\x)--(-7.07+\x/1.41,-7.07+\x/1.41); \draw(-\x,0)--(-7.07+\x/1.41,-7.07+\x/1.41); \draw(0,\x)--(-7.07+\x/1.41,7.07-\x/1.41); \draw(-\x,0)--(-7.07+\x/1.41,7.07-\x/1.41); %外圈 \draw(0,\x)--(\x/1.41,10+\x/1.41); \draw(\x/1.41,\x/1.41)--(7.07+\x,7.07); \draw(\x,0)--(10+\x/1.41,-\x/1.41); \draw(\x/1.41,-\x/1.41)--(7.07,-7.07-\x); \draw(0,-\x)--(-\x/1.41,-10-\x/1.41); \draw(-\x/1.41,-\x/1.41)--(-7.07-\x,-7.07); \draw(-\x,0)--(-10-\x/1.41,\x/1.41); \draw(-\x/1.41,\x/1.41)--(-7.07,7.07+\x); } \end{tikzpicture} \end{center}\par \end{document}