<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%# -*- coding: utf-8 -*-
% xiantu.tex
% asymptotebyexample çš„ä¸€ç«&nbsp;ï¼Œæœ€åŸºç¡€çš„ç”»å›¾çŸ¥è¯†

\chapter{èµµçˆ½çš„å¼¦å›¾}
\label{chap:xiantu}
\nocite{quanjing}

èµµçˆ½åšå£«æ˜¯ä½è€çŸ¥è¯†åˆ†å­ï¼Œç&nbsp;”ç©¶å…´è¶£æ˜¯å¤©æ–‡åŽ†æ³•ä¸Žç®—å­¦ï¼Œä¸€ç”Ÿç²¾ç&nbsp;”ã€Šå‘¨é«€ç®—ç»ã€‹ã€‚ä¸è¿‡
èµµè€çˆ·å­å¹´è½»çš„æ—¶å€™ä¹¦ç±éƒ½æ˜¯æ‰‹å†™ï¼Œæœ€è¿‘æ‰ç´§è·Ÿæ—¶ä»£æ½®æµç”¨ä¸Šäº†ç”µè„‘ã€‚çŽ°åœ¨ä»–è¦ä¿®è®¢ä»–
ç&nbsp;”ç©¶ã€Šå‘¨é«€ç®—ç»ã€‹çš„æœ­è®°ï¼Œå†³å®šä½¿ç”¨ \LaTeX{} æ¥æŽ’ç‰ˆã€‚

çŽ°åœ¨ä»–é‡åˆ°ä¸€ä¸ªéš¾é¢˜ï¼Œå°±æ˜¯ä»–è¦ç”»å‡ºç¬”è®°ä¸­è®²è§£å‹¾è‚¡å®šç†çš„ä¸€å¹…å¼¦å›¾ã€‚å¬äººä»‹ç»ï¼Œå‡&nbsp;ç»
æ¯”è¾ƒä¹‹åŽï¼Œä»–å†³å®šä½¿ç”¨çŽ°åœ¨ç‚’å¾—ç«çƒ­çš„ \Asy{}ã€‚

èµµåšå£«çš„åŽŸå›¾æ˜¯æ‰‹ç”»çš„ï¼Œçº¿æ¡†å¤šæœ‰ä¸ç›´ä¸å‡†çš„ï¼Œ\autoref{fig:xiantuancient} å°±æ˜¯æ—§
å¹´æ®æ‰‹ç¨¿åšçš„é›•ç‰ˆå›¾ï¼Œèµµåšå£«å¹¶ä¸æ»¡æ„ã€‚èµµçˆ½åšå£«ç†æƒ³ä¸­çš„å›¾ï¼Œçº¿æ¡è¦å¹³æ•´ç¾Žè§‚ï¼Œæ–‡å­—
è¦æ¸…æ¥šæ•´é½ï¼Œå›¾å½¢è¿˜è¦ä¸Šè‰²ï¼šæœ±å®žè‡ªç„¶å¾—ç”¨çº¢è‰²ï¼Œé»„å®žä¹Ÿè¯¥ç”¨é»„è‰²ï¼Œä»¥ä¸Žæ³¨æ–‡ä¸€è‡´â€”â€”
å°±æ˜¯\autoref{fig:xiantu} çš„æ&nbsp;·å­ã€‚

\begin{figure}
  \centering
  \includegraphics[height=\textheight-2\baselineskip]{xiantu-ancient.pdf}
  \caption{æ—§å¹´åšçš„é›•ç‰ˆ}
  \label{fig:xiantuancient}
\end{figure}
\begin{figure}
  \centering
  \includegraphics{xiantu.pdf}
  \caption{ç†æƒ³ä¸­çš„æ–°ç‰ˆæœ¬}
  \label{fig:xiantu}
\end{figure}

è®¡è®®å·²å®šï¼Œèµµåšå£«è¦å¼€å§‹æ­£å¼çš„ç»˜å›¾äº†ã€‚

\section{ç»˜å›¾çŽ¯å¢ƒ}

\Asy{} çš„å®‰è£…å¹¶ä¸å¤æ‚ï¼Œåœ¨ Windows ä¸‹é¢å°±æ˜¯ä¸‹è½½è¿è¡Œé‚£ä¸ªå®‰è£…åŒ…ï¼Œåœ¨ Linux ä¸‹é¢ä¸€
èˆ¬ä¹Ÿåªéœ€è¦ä¸‹è½½å¯¹åº”çš„åŽ‹ç¼©åŒ…ï¼Œè§£åŽ‹å°±å¯ä»¥ä½¿ç”¨äº†ã€‚å“¦ï¼Œèµµåšå£«ç”¨çš„å°±æ˜¯ Windowsã€‚

ç‚¹å›¾æ&nbsp;‡è¿è¡Œ \Asy{}ï¼Œå°±å‡ºçŽ°äº†äº¤äº’å¼\index{äº¤äº’å¼}çš„å‘½ä»¤è¡Œï¼Œæç¤ºç¬¦æ˜¯ä¸€ä¸ª
\verb=&gt;=ã€‚è¾“å…¥å‘½ä»¤ï¼š
\begin{lstlisting}
draw((0,0) -- (3cm,4cm));   // `\color{comment}ä¸€æ¡ç›´çº¿`
\end{lstlisting}
èµµåšå£«è£…çš„ GSView ç«‹å³å¼¹äº†å‡ºæ¥ï¼Œé‡Œé¢å·²ç»ç”»å‡ºä¸€æ¡å€¾æ–œçš„ç›´çº¿ã€‚å†è¾“å…¥
|quit|\index{quit@\lstinline=quit=}ï¼Œç¨‹åºé€€å‡ºï¼Œå¹¶ç•™ä¸‹äº†ä¸€ä¸ªå«åš
\verb=out.eps= çš„å›¾å½¢æ–‡ä»¶ï¼Œ
å°èœä¸€ç¢Ÿã€‚

è¿™é‡Œç¨ç¨è§£é‡Šä¸€ä¸‹ä¸Šé¢çš„ä¸€å¥ä»£ç&nbsp;ã€‚|draw|\index{draw@\lstinline=draw=} æ˜¯ç”»çº¿çš„
å‘½ä»¤ï¼Œæ›´å‡†ç¡®åœ°è¯´ï¼Œæ˜¯ \Asy{} ä¸­çš„å‡½æ•°\index{å‡½æ•°}ï¼šå®ƒå¸¦æœ‰ä¸€ä¸ªå‚æ•°\index{å‚æ•°}
|(0,0) -- (3cm,4cm)|ï¼Œå‚æ•°å¤–é¢æ˜¯åœ†æ‹¬å·ï¼Œæ•´ä¸ªå‘½ä»¤ä»¥åˆ†å·ç»“æŸã€‚é‡Œé¢çš„
|(0,0) -- (3cm,4cm)| æ˜¯ç”±ä¸¤ä¸ªåæ&nbsp;‡\index{åæ&nbsp;‡}è¿žæŽ¥è€Œæˆçš„ç›´çº¿ï¼Œåæ&nbsp;‡æ˜¯åœ¨ç›´è§’åæ&nbsp;‡
ç³»ä¸‹çš„ï¼Œå¯ä»¥å¸¦å•ä½ |mm|, |cm|, |pt|, |bp|, |inch|, |inches|ï¼Œ%
\index{mm@\lstinline=mm=}\index{cm@\lstinline=cm=}\index{pt@\lstinline=pt=}%
\index{bp@\lstinline=bp=}\index{inch@\lstinline=inch=}%
\index{inches@\lstinline=inches=}%
å…¶æ„ä¹‰ä¸Žåœ¨\TeX{} ä¸­çš„ä¸€æ&nbsp;·ï¼Œå¦‚æžœä¸å¸¦å•ä½ï¼Œåˆ™é»˜è®¤ä¸º |bp|ã€‚è¡Œæœ«ä»¥ |//| å¼€å¤´çš„æ˜¯
æ³¨é‡Šï¼Œå¦æœ‰ä¸€ç§åœ¨ |/* */| ä¹‹é—´çš„æ³¨é‡Š\index{æ³¨é‡Š}ï¼Œä¸Ž C è¯­è¨€ç›¸åŒã€‚

\index{ç¼–è¯‘}
ä¸è¿‡èµµåšå£«å†™ä¹¦è®²æ±‚èƒ¸æœ‰æˆç«¹æ–¹æ‰ä¸‹ç¬”ï¼Œå›&nbsp;æ­¤ä»–æ›´æ„¿æ„ä½¿ç”¨æ›´ä¸€ç§æ–¹å¼ï¼šæ‰“å¼€ä¸€ä¸ªæ–‡æœ¬
ç¼–è¾‘å™¨ï¼ŒæŠŠä¸Šé¢çš„ç»˜å›¾å‘½ä»¤éƒ½å½•å…¥å®Œæ¯•ï¼Œä¿å­˜ä¸ºä¸€ä¸ªåä¸º \verb=line.asy= çš„æ–‡ä»¶ï¼Œæœ€
åŽæŠŠè¿™ä¸ªæ–‡ä»¶æ‹–åŠ¨åˆ° \Asy{} çš„å›¾æ&nbsp;‡ä¸Šé¢ï¼Œå°±å®Œæˆäº†æ•´ä¸ªä½œå›¾ã€‚

èµµåšå£«çš„å°ä¾„å­ä¸å±‘äºŽè¿™ç§å¿«æ·å›¾æ&nbsp;‡çš„ç¼–è¯‘æ–¹å¼ï¼Œä»–ç›´æŽ¥è¿›å…¥å‘½ä»¤è¡Œï¼Œè¾“å…¥
\verb=asy=ï¼Œå°±è¿›å…¥äº† \Asy{} çš„äº¤äº’çŽ¯å¢ƒï¼›è¦æ˜¯è¾“å…¥ \verb=asy line=ï¼Œå°±ç”»å‡ºäº†åˆš
æ‰çš„ä¿å­˜çš„ç›´çº¿ã€‚


\section{ç›´çº¿ä¸Žç»˜å›¾å‘½ä»¤}
\label{sec:linedraw}

å¼¦å›¾çš„å›¾å½¢å…¶å®žå¾ˆç®€å•ï¼Œéƒ½æ˜¯ç›´çº¿ã€æ–¹å—ã€ä¸‰è§’å½¢è¿™äº›ï¼Œè€Œä¸”ä¸ºäº†è®¡ç®—çš„ç®€ä¾¿ï¼Œæ‰€æœ‰é•¿
åº¦ä¹Ÿéƒ½æ˜¯æ•´æ•°å€¼ã€‚é‚£ä¹ˆï¼Œé¦–å…ˆå°±æ˜¯åœ¨ \Asy{} ä¸­æ¥ç”»ç›´çº¿ã€‚

\index{ç”»çº¿}
æ­£å¦‚å‰é¢è¯•éªŒçš„æ—¶å€™åšçš„é‚£æ&nbsp;·ï¼Œä¸€æ¡ç›´çº¿å°±æ˜¯ç”¨ |--|\index{--@\lstinline=--=} æŠŠå
æ&nbsp;‡è¿žèµ·æ¥ï¼Œå†ä½¿ç”¨ |draw| å‘½ä»¤ï¼Œç›´çº¿å°±ç”»å‡ºæ¥äº†ã€‚äº‹å®žä¸Šï¼Œå¯ä»¥ç”¨ |--| æŠŠåæ&nbsp;‡ç‚¹è¿ž
æˆæŠ˜çº¿ï¼š
\begin{lstlisting}
draw( (0,0) -- (1cm,0) -- (2cm,0.5cm) -- (1cm,1cm) -- (0,1cm) );
\end{lstlisting}
\begin{figure}[H]
\centering
\begin{asy}
draw( (0,0) -- (1cm,0) -- (2cm,0.5cm) -- (1cm,1cm) -- (0,1cm) );
\end{asy}
\end{figure}

åƒè¿™æ&nbsp;·æŠŠåæ&nbsp;‡ç”¨ |--| è¿žç»“èµ·æ¥çš„ï¼Œå°±æˆä¸ºä¸€æ¡è·¯å¾„\index{è·¯å¾„}ã€‚æŠŠç›´çº¿è€Œç¨åšä¿®æ”¹
ï¼Œåœ¨åŽé¢è¿žä¸Šä¸€ä¸ªç‰¹æ®Šçš„åæ&nbsp;‡ |cycle|\index{cycle@\lstinline=cycle=}ï¼Œå°±å¯ä»¥å¾—åˆ°
ä¸€æ¡é¦–å°¾ç›¸æŽ¥çš„é—­è·¯å¾„\index{è·¯å¾„!é—­è·¯å¾„}ã€‚å¦‚ï¼š
\begin{lstlisting}
draw( (0,0) -- (1cm,0) -- (2cm,0.5cm) -- (1cm,1cm) -- (0,1cm) -- cycle );
\end{lstlisting}
\begin{figure}[H]
\centering
\begin{asy}
draw( (0,0) -- (1cm,0) -- (2cm,0.5cm) -- (1cm,1cm) -- (0,1cm) -- cycle );
\end{asy}
\end{figure}

ç”»ä¸€æ¡è·¯å¾„å¯ä»¥ä½¿ç”¨ä¸åŒçš„é¢œè‰²ã€ç²—ç»†çš„ç¬”ï¼Œè¿™åªè¦ç»™ |draw| å‘½ä»¤å¤šåŠ&nbsp;ä¸€ä¸ªç”»ç¬”
\index{ç”»ç¬”}å‚æ•°ï¼ˆå¤šä¸ªå‚æ•°ç”¨é€—å·åˆ†å¼€ï¼‰ï¼š
\begin{lstlisting}
draw((0,0) -- (1cm,0) -- (2cm,0.5cm) -- (1cm,1cm) -- (0,1cm), darkblue+1mm);
\end{lstlisting}
\begin{figure}[H]
\centering
\begin{asy}
draw((0,0) -- (1cm,0) -- (2cm,0.5cm) -- (1cm,1cm) -- (0,1cm), darkblue+1mm);
\end{asy}
\end{figure}
è¿™é‡Œ |darkblue| æ˜¯é¢œè‰²ï¼Œ|1mm| æ˜¯çº¿çš„ç²—ç»†ã€‚|darkblue+1mm| å³æŒ‡ä¸€æ¯«ç±³å®½çš„æ·±
è“è‰²ç²—çº¿ã€‚ï¼ˆå¯ç”¨çš„é¢œè‰²\index{é¢œè‰²}åç§°å¯ä»¥å‚è€ƒ \cite{asyman}ï¼‰

èµµåšå£«ç”»çš„æ˜¯â€œå‹¾ä¸‰è‚¡å››å¼¦äº”â€çš„çº¢è‰²ä¸‰è§’å½¢ï¼Œè¿™å¾ˆå®¹æ˜“ï¼š
\begin{lstlisting}
draw( (0,0) -- (4cm,0) -- (0,3cm) -- cycle, red+0.5mm );
\end{lstlisting}
\begin{figure}[H]
\centering
\begin{asy}
draw( (0,0) -- (4cm,0) -- (0,3cm) -- cycle, red+0.5mm );
\end{asy}
\end{figure}

\index{å¡«å……}
ä¸è¿‡çŽ°åœ¨è¿˜éœ€è¦çš„æ˜¯å®žå¿ƒçš„ä¸‰è§’å½¢ï¼Œå›&nbsp;æ­¤å°±éœ€è¦ä¸€ä¸ªæ–°çš„ç»˜å›¾å‘½ä»¤
|fill|\index{fill@\lstinline=fill=}ï¼Œå³å¡«å……ã€‚äºŽæ˜¯ï¼Œçº¢è‰²ä¸‰è§’å½¢å°±æˆä¸º
\begin{lstlisting}
fill( (0,0) -- (4cm,0) -- (0,3cm) -- cycle, red );
\end{lstlisting}
\begin{figure}[H]
\centering
\begin{asy}
fill( (0,0) -- (4cm,0) -- (0,3cm) -- cycle, red );
\end{asy}
\end{figure}

ä½†è¿™æ&nbsp;·ä¸€æ¥ä¸‰è§’å½¢çš„é¢œè‰²å°±å¤ªé‡äº†ï¼Œè€Œä¸”è¾¹ç•Œä¹Ÿä¸æ¸…æ¥šã€‚å›&nbsp;æ­¤ä¼¼ä¹Žåº”è¯¥å…ˆç”¨æµ…çº¢è‰²å¡«å……
ä¸€éï¼Œç„¶åŽå†ç”¨æ·±çº¢è‰²å‹¾è¾¹ã€‚å¥½åœ¨å¯ä»¥ä½¿ç”¨ä¸€ä¸ªå‘½ä»¤
|filldraw|\index{filldraw@\lstinline=filldraw=} åŒæ—¶å®Œæˆè¿™ä¸¤ä»¶äº‹æƒ…ï¼Œè¿™æ&nbsp;·å°±ä¸
éœ€è¦æŠŠä¸€æ¡è·¯å¾„å†™ä¸¤éäº†ã€‚å³æœ‰ï¼š
\begin{lstlisting}
filldraw((0,0) -- (4cm,0) -- (0,3cm) -- cycle,
    fillpen=palered, drawpen=red+0.5mm);
\end{lstlisting}
\begin{figure}[H]
\centering
\begin{asy}
filldraw((0,0) -- (4cm,0) -- (0,3cm) -- cycle,
    fillpen=palered, drawpen=red+0.5mm);
\end{asy}
\end{figure}
è¿™é‡Œå¯ä»¥ç®€å•åœ°ç›´æŽ¥å†™ä¸¤ä¸ªå‚æ•° |palered, red+0.5mm|ï¼Œä¸è¿‡ä¸ºäº†æ¸…æ™°èµ·è§è¿˜æ˜¯ä½¿ç”¨
â€œ$\text{é”®}=\text{å€¼}$â€çš„å†™æ³•ï¼Œæ˜Žç¡®è¡¨ç¤ºå‡ºå¡«å……çš„ç”»ç¬”å’Œæçº¿çš„ç”»ç¬”ã€‚

çŽ°åœ¨ï¼Œèµµåšå£«çš„æ•´ä¸ªå¼¦å›¾çš„æ¡†æž¶å°±å‘¼ä¹‹æ¬²å‡ºäº†ï¼Œå°±æ˜¯ç”»å‡ºå››ä¸ªä¸‰è§’å½¢
ï¼ˆ\autoref{fig:xiantuskeleton}ï¼‰ï¼š
\begin{lstlisting}
filldraw( (4cm,0) -- (4cm,3cm) -- (0,3cm) -- cycle,
    fillpen=palered, drawpen=red+0.5mm);
filldraw( (7cm,4cm) -- (4cm,4cm) -- (4cm,0) -- cycle,
    fillpen=palered, drawpen=red+0.5mm);
filldraw( (3cm,7cm) -- (3cm,4cm) -- (7cm,4cm) -- cycle,
    fillpen=palered, drawpen=red+0.5mm);
filldraw( (0,3cm) -- (3cm,3cm) -- (3cm,7cm) -- cycle,
    fillpen=palered, drawpen=red+0.5mm);
\end{lstlisting}
\begin{figure}
\centering
\begin{asy}
filldraw( (4cm,0) -- (4cm,3cm) -- (0,3cm) -- cycle,
    fillpen=palered, drawpen=red+0.5mm);
filldraw( (7cm,4cm) -- (4cm,4cm) -- (4cm,0) -- cycle,
    fillpen=palered, drawpen=red+0.5mm);
filldraw( (3cm,7cm) -- (3cm,4cm) -- (7cm,4cm) -- cycle,
    fillpen=palered, drawpen=red+0.5mm);
filldraw( (0,3cm) -- (3cm,3cm) -- (3cm,7cm) -- cycle,
    fillpen=palered, drawpen=red+0.5mm);
\end{asy}
\caption{å¼¦å›¾çš„åˆæ­¥æ¡†æž¶}\label{fig:xiantuskeleton}
\end{figure}

è¿˜åº”è¯¥ç”»å‡ºå¼¦å›¾çš„ä¸­é—´çš„â€œé»„å®žâ€ï¼Œç”¨é»„è‰²å¡«å……ã€‚è¿™éƒ¨åˆ†æ˜¯ä¸€ä¸ªæ­£æ–¹å½¢ï¼Œå¯ä»¥ä½¿ç”¨çŽ°æˆ
çš„ \lstinline[mathescape]|box($\text{è§’ç‚¹}$, $\text{è§’ç‚¹}$)|
\index{box@\lstinline=box=} å‘½ä»¤æ¥äº§ç”ŸçŸ©å½¢çš„è·¯å¾„ï¼Œå›&nbsp;è€Œå¡«å……æ­£ä¸­é—´çš„æ­£æ–¹å½¢å°±å¯
ä»¥ç”¨ï¼š
\begin{lstlisting}
fill( box((3cm,3cm), (4cm,4cm)), yellow );
\end{lstlisting}
è¿™ä¸ªå¡«å……çš„å‘½ä»¤åº”è¯¥æ”¾åœ¨ç”»çº¿ä¹‹å‰ï¼ˆä»¥å…è¦†ç›–æçš„çº¢çº¿ï¼‰ã€‚

å›žé¡¾å‰é¢çš„ä»£ç&nbsp;ï¼Œèµµåšå£«è§‰å¾—è¿žç»­åœ°å†™å››ä¸ª |filldraw| å‘½ä»¤å¤ªé‡å¤äº†ã€‚ä»–è¯»äº† \Asy{}
çš„æ–‡æ¡£ \cite{asyman}ï¼Œæ‰çŸ¥é“å¤šæ¡è·¯å¾„å¯ä»¥ç”¨ç¬¦å· |^^|\index{^@\lstinline=^^=} 
è¿žèµ·æ¥ï¼Œä¸€èµ·ä½¿ç”¨ï¼ŒäºŽæ˜¯ç«‹å³ç€æ‰‹æ”¹è¿›åŽŸæ¥çš„ä»£ç&nbsp;ã€‚

è€Œä¸”ï¼Œç”±äºŽè¿˜æ‰“ç®—åœ¨å›¾çš„åŽé¢ç”»å‡ºå‚è€ƒç½‘æ&nbsp;¼ï¼Œå›¾å½¢çš„é¢œè‰²è¿˜åº”è¯¥è®¾ç½®ä¸ºåŠé€æ˜Ž\index{é€
æ˜Ž}çš„ã€‚å¥½åœ¨è¿™å¹¶ä¸éš¾å®žçŽ°ï¼Œåªè¦ç¨ç¨æ”¹åŠ¨ä¸€ä¸‹å¡«å……çš„ç”»ç¬”ï¼Œä½¿ç”¨
\lstinline[mathescape]|opacity($\text{æ•°å€¼}$)|
\index{opacity@\lstinline=opacity=}
æ¥è®¾å®šæœ‰ä¸€å®šä¸é€æ˜Žåº¦ï¼ˆå–å€¼ä¸º $0\sim1$ï¼‰çš„ç”»ç¬”ï¼Œå¹¶æŠŠå®ƒåŠ&nbsp;åœ¨åŽŸæ¥çš„ç”»ç¬”ä¸Šã€‚äºŽæ˜¯èµµ
åšå£«æœ€åŽå†™å‡ºäº†è¿™æ&nbsp;·çš„ä»£ç&nbsp;ï¼š
\begin{lstlisting}
fill( box((3cm,3cm), (4cm,4cm)), opacity(0.5)+yellow );
filldraw( (4cm,0) -- (4cm,3cm) -- (0,3cm) -- cycle
    ^^ (7cm,4cm) -- (4cm,4cm) -- (4cm,0) -- cycle
    ^^ (3cm,7cm) -- (3cm,4cm) -- (7cm,4cm) -- cycle
    ^^ (0,3cm) -- (3cm,3cm) -- (3cm,7cm) -- cycle,
    fillpen=opacity(0.1)+red, drawpen=red+0.5mm );
\end{lstlisting}
è‡³æ­¤ï¼Œå¼¦å›¾çš„ä¸»è¦æ¡†æž¶ï¼ˆ\autoref{fig:xiantuskeleton2}ï¼‰å°±æ­¤å®Œæˆã€‚
\begin{figure}[H]
\centering
\begin{asy}
fill( box((3cm,3cm), (4cm,4cm)), opacity(0.5)+yellow );
filldraw( (4cm,0) -- (4cm,3cm) -- (0,3cm) -- cycle
    ^^ (7cm,4cm) -- (4cm,4cm) -- (4cm,0) -- cycle
    ^^ (3cm,7cm) -- (3cm,4cm) -- (7cm,4cm) -- cycle
    ^^ (0,3cm) -- (3cm,3cm) -- (3cm,7cm) -- cycle,
    fillpen=opacity(0.1)+red, drawpen=red+0.5mm );
\end{asy}
\caption{å¼¦å›¾çš„è¿›ä¸€æ­¥ä¼˜åŒ–çš„æ¡†æž¶}\label{fig:xiantuskeleton2}
\end{figure}


\section{å›¾å½¢å˜æ¢ä¸ŽåŠŸèƒ½æ¨¡å—çš„ä½¿ç”¨}

ç„¶åŽæ˜¯ç”»ä½œä¸ºé•¿åº¦å‚è€ƒçš„ç½‘æ&nbsp;¼ã€‚å…¶å®žç½‘æ&nbsp;¼ä¸€å¼€å§‹å°±è¯¥åœ¨å›¾ä¸­ç”»å‡ºæ¥ï¼Œè¿™æ&nbsp;·åŽé¢ç”»å›¾å‡†ç¡®
ä¸Žå¦æ‰èƒ½çœ‹å¾—æ¸…æ¥šã€‚ä¸è¿‡çŽ°åœ¨èµµåšå£«æ˜¯é‡ä½œæ—§å›¾ï¼Œå›¾æ&nbsp;·å·²å®šï¼Œç½‘æ&nbsp;¼å°±æåœ¨å¼¦å›¾çš„ä¸»è¦å›¾
å½¢åŽé¢æ‰ç”»äº†ã€‚

æŒ‰è¯´è¿™ä¸ªç½‘æ&nbsp;¼æ˜¯ååˆ†ç®€å•çš„ï¼Œæ—&nbsp;éžå°±æ˜¯ç”»ä¸€äº›ç°è‰²çš„çºµæ¨ªç»†çº¿ã€‚æ¯”å¦‚è¿™ä¸ª $3\times3$ 
çš„ç½‘æ&nbsp;¼ï¼š
\begin{lstlisting}
draw( (0,0) -- (3cm,0)
    ^^ (0,1cm) -- (3cm,1cm)
    ^^ (0,2cm) -- (3cm,2cm)
    ^^ (0,3cm) -- (3cm,3cm),
    gray );
draw( (0,0) -- (0,3cm)
    ^^ (1cm,0) -- (1cm,3cm)
    ^^ (2cm,0) -- (2cm,3cm)
    ^^ (3cm,0) -- (3cm,3cm),
    gray );
\end{lstlisting}
\begin{figure}[H]
\centering
\begin{asy}
draw( (0,0) -- (3cm,0)
    ^^ (0,1cm) -- (3cm,1cm)
    ^^ (0,2cm) -- (3cm,2cm)
    ^^ (0,3cm) -- (3cm,3cm),
    gray );
draw( (0,0) -- (0,3cm)
    ^^ (1cm,0) -- (1cm,3cm)
    ^^ (2cm,0) -- (2cm,3cm)
    ^^ (3cm,0) -- (3cm,3cm),
    gray );
\end{asy}
\end{figure}

å¯æ—&nbsp;ç–‘è¿™ä¸ªåŠžæ³•æ˜¾å¾—å¤ªéº»çƒ¦äº†ï¼Œèµµåšå£«è¦ç”»çš„æ˜¯ $7\times7$ çš„ç½‘æ&nbsp;¼ï¼Œå°±è¦åˆ†åˆ«ç”»å‡º
$16$ æ¡ç›´çº¿ã€‚è¿™æ&nbsp;·çš„ä»£ç&nbsp;ä¸ä»…ä¸å¥½å†™ï¼Œè€Œä¸”å®¹æ˜“å‡ºé”™ï¼Œä¿®æ”¹ä¸€ä¸‹ä¹Ÿå¾ˆéº»çƒ¦ã€‚

èµµåšå£«çœ‹åˆ°äº†æ‰‹å†Œ \cite{asyman} ä¸­è®²å¾ªçŽ¯è¯­å¥çš„ç”¨æ³•ï¼Œä¼¼ä¹Žå¯ä»¥å®Œæˆè¿™ä»¶äº‹ã€‚å¯æ˜¯ä»¥
èµµåšå£«çš„å¹´é¾„ï¼Œå†åŽ»çœ‹ä»€ä¹ˆç¼–ç¨‹ä»€ä¹ˆå˜é‡çš„ï¼Œå‘½ä»¤ä¸èƒ½ä¸€æ¡ä¸€æ¡æ‰§è¡Œä¸‹æ¥ï¼Œå¾ˆä¸ä¹&nbsp;æƒ¯ï¼Œ
å¤´è„‘å°±å¾€å¾€è½¬ä¸æ¸…æ¥šã€‚

\index{æ¨¡å—!math@\prgname{math}}
äºŽæ˜¯èµµåšå£«å°±åŽ»è®ºå›ä¸Šå’¨è¯¢ï¼Œä¸€äº›äººåŠä»–åŽ»ç”¨å‡&nbsp;è¡Œå¾ªçŽ¯è¯­å¥ï¼Œç”šè‡³æœ‰äººå·²ç»æŠŠå®Œæ•´çš„å‡½
æ•°åšå¥½äº†ã€‚ä½†æœ‰ä¸€ä¸ªç»“æžœç‰¹åˆ«å¼•äººæ³¨ç›®ï¼Œæœ‰äººæŒ‡å‡ºï¼Œåœ¨ \prgname{math} æ¨¡å—ä¸­å·²ç»å®š
ä¹‰å¥½äº†ä¸€ä¸ª |grid| å‡½æ•°ï¼Œåªè¦æ‹¿æ¥ç”¨å°±å¯ä»¥äº†ã€‚èµµåšå£«ç«‹å³ç²¾ç¥žå¤§æŒ¯ï¼Œæ¥çœ‹è¿™ä¸ª
|grid| å‡½æ•°ï¼š\index{grid@\lstinline=grid=}
\begin{lstlisting}
picture grid(int Nx, int Ny, pen p=currentpen)
\end{lstlisting}
è¿™ä¸ªæ˜¯åœ¨ \prgname{math} æ¨¡å—ä¸­ |grid| å‡½æ•°çš„åŽŸåž‹ã€‚\index{åŽŸåž‹}å®ƒè¯´æ˜Ž |grid| 
å‡½æ•°æœ‰ |Nx|, |Ny| ä¸¤ä¸ªæ•´æ•°ç±»åž‹çš„å¿…éœ€å‚æ•°ï¼Œä¸€ä¸ªå¯é€‰çš„ç”»ç¬”ï¼Œå¹¶ä¸”è¿”å›žä¸€ä¸ª
|picture|ï¼ˆå›¾ï¼‰\index{picture@\lstinline=picture=}ç±»åž‹çš„å¯¹è±¡ã€‚

\index{å¯¼å…¥}\index{æ¨¡å—!å¯¼å…¥}
è¦ä½¿ç”¨æ¨¡å—çš„åŠŸèƒ½ï¼Œéœ€è¦åœ¨ç»˜å›¾ä¹‹å‰å¯¼å…¥è¿™ä¸ªæ¨¡å—ï¼Œè¿™åªè¦ä½¿ç”¨
\index{import@\lstinline=import=}
\begin{lstlisting}
import `æ¨¡å—å`;
\end{lstlisting}
å›&nbsp;æ­¤ï¼Œè¦ä½¿ç”¨ \prgname{math} æ¨¡å—ä¸­çš„ |grid| å‡½æ•°ï¼Œåªè¦åœ¨ä»£ç&nbsp;ä¸­å†™
\begin{lstlisting}
import math;
\end{lstlisting}
å°±å¯ä»¥äº†ã€‚

|grid| å‡½æ•°çš„è¡Œä¸ºçœ‹èµ·æ¥å¾ˆå¥‡æ€ªï¼Œè°ƒç”¨å®ƒä¼šåœ¨ä¸€ä¸ªå•ç‹¬çš„å›¾ä¸Šç”»å‡ºä¸€ä¸ª
|Nx|${}\times{}$|Ny| çš„ç½‘æ&nbsp;¼ï¼Œç½‘æ&nbsp;¼çš„å·¦ä¸‹è§’åœ¨åŽŸç‚¹ï¼Œé—´è·ä¸º $1$ã€‚è¦ä½¿ç”¨ |grid| å‡½
æ•°ç”»çš„å›¾å½¢ï¼Œè¦ä½¿ç”¨ \lstinline[mathescape]|add($\text{å›¾}$)|
\index{add@\lstinline=add=} å‘½ä»¤ï¼ŒæŠŠè¿™ä¸ªå›¾å½¢åŠ&nbsp;åœ¨å½“å‰çš„å›¾ä¸Šï¼š
\begin{lstlisting}
import math;
add(grid(10,10,gray));
\end{lstlisting}
\begin{figure}[H]
\centering
\begin{asy}
import math;
add(grid(10,10,gray));
\end{asy}
\end{figure}
ä¸è¿‡ç›´æŽ¥è¿™æ&nbsp;·åšçš„ç»“æžœæ˜¯åªèƒ½å¾—åˆ°ä¸€ä¸ªå°å¾—å·²ç»çœ‹ä¸æ¸…çš„ç½‘æ&nbsp;¼ã€‚å›&nbsp;æ­¤ï¼Œå¿…é¡»å¯¹å›¾å½¢è¿›è¡Œæ”¾ç¼©ã€‚

\index{å˜æ¢}\index{ä»¿å°„å˜æ¢}
\index{å˜æ¢!å¹³ç§»}\index{å˜æ¢!æ—‹è½¬}\index{å˜æ¢!æ”¾ç¼©}
\index{å˜æ¢!é”™åˆ‡}\index{å˜æ¢!åå°„}
\Asy{} æä¾›äº†å¹³ç§»ã€æ—‹è½¬ã€æ”¾ç¼©ã€å€¾æ–œã€åå°„ç­‰å„ç§çš„ä»¿å°„å˜æ¢ï¼Œæ¥å¯¹åæ&nbsp;‡ã€è·¯å¾„ã€å›¾
å½¢ç­‰å…ƒç´&nbsp;è¿›è¡Œå˜æ¢ï¼ˆä¸¥æ&nbsp;¼çš„å‡½æ•°åŽŸåž‹å‚è€ƒ \cite{asyman}ï¼‰ï¼š
\index{shift@\lstinline=shift=}
\index{scale@\lstinline=scale=}
\index{xscale@\lstinline=xscale=}
\index{yscale@\lstinline=yscale=}
\index{rotate@\lstinline=rotate=}
\index{slant@\lstinline=slant=}
\index{reflect@\lstinline=reflect=}
\begin{lstlisting}
shift(`åæ&nbsp;‡`)           // `\color{comment}æŒ‰åæ&nbsp;‡å¹³ç§»`
shift(x, y)           // `\color{comment}æŒ‰` (x, y) `\color{comment}å¹³ç§»`
scale(`å€æ•°`)           // `\color{comment}æŒ‰å€æ•°æ”¾ç¼©`
xscale(`å€æ•°`)          // `\color{comment}$x$ è½´æ–¹å‘æŒ‰å€æ•°æ”¾ç¼©`
yscale(`å€æ•°`)          // `\color{comment}$y$ è½´æ–¹å‘æŒ‰å€æ•°æ”¾ç¼©`
scale(x, y)           // `\color{comment}åœ¨ $x$ è½´ã€$y$ è½´æ–¹å‘åˆ†åˆ«æŒ‰å€æ•°` x, y `\color{comment}æ”¾ç¼©`
rotate(`è§’åº¦`, z=(0,0)) // `\color{comment}æŒ‰è§’åº¦ç»•ä¸­å¿ƒ` z`\color{comment}ï¼ˆé»˜è®¤ä¸ºåŽŸç‚¹ï¼Œé€†æ—¶é’ˆï¼‰æ—‹è½¬`
slant(`å›&nbsp;å­`)           // `\color{comment}æŒ‰ä¸€å®šå›&nbsp;å­å‘å³å€¾æ–œ`
reflect(a, b)         // `\color{comment}ç›¸å¯¹ç›´çº¿` a--b `\color{comment}åå°„`
\end{lstlisting}
ä½¿ç”¨ä¸€ä¸ªå˜æ¢å°±æ˜¯æŠŠè¿™ä¸ªå˜æ¢ä¹˜åœ¨è¢«å˜æ¢å¯¹è±¡çš„å·¦è¾¹ã€‚ä¾‹å¦‚ä¸€ä¸ªæ”¾ç¼©ä¸€ä¸ªå•ä½æ­£æ–¹å½¢ï¼š
\begin{lstlisting}
draw( scale(2cm) * box((0,0), (1,1)) );
\end{lstlisting}
\begin{figure}[H]
\centering
\begin{asy}
draw( scale(2cm) * box((0,0), (1,1)) );
\end{asy}
\end{figure}
è¿™æ&nbsp;·çš„å˜æ¢å¯ä»¥è¿žç»­åœ°åšä¸‹åŽ»ï¼Œä¾‹å¦‚
\begin{lstlisting}
draw( rotate(90) * slant(0.3) * scale(1cm) * box((0,0), (1,1)) );
\end{lstlisting}
å°±æ˜¯æŠŠä¸€ä¸ªå•ä½æ­£æ–¹å½¢å…ˆæ”¾å¤§ï¼Œå†å€¾æ–œï¼Œå†æ—‹è½¬ $90^\circ$ï¼š
\begin{figure}[H]
\centering
\begin{asy}
draw( rotate(90) * slant(0.3) * scale(1cm) * box((0,0), (1,1)) );
\end{asy}
\end{figure}

æœ‰äº†è¿™äº›å˜æ¢ï¼Œç”»å‡ºä¸€ä¸ªåˆé€‚å¤§å°çš„ç½‘æ&nbsp;¼å°±ä¸å†æ˜¯ä»€ä¹ˆéš¾äº‹äº†ï¼š
\begin{lstlisting}
import math;
add( scale(5mm) * grid(4, 4, gray) );
\end{lstlisting}
\begin{figure}[H]
\centering
\begin{asy}
import math;
add( scale(5mm) * grid(4, 4, gray) );
\end{asy}
\end{figure}

èµµåšå£«çš„å¼¦å›¾æœ‰ä¸¤ä¸ªç½‘æ&nbsp;¼ï¼Œä¸ä»…è¦å¤§å°åˆé€‚ï¼Œè€Œä¸”å…¶ä¸­ä¸€ä¸ªéœ€è¦è¿›è¡Œæ—‹è½¬å’Œå¹³ç§»ã€‚å¹³ç§»
çš„ä½ç½®å¾ˆæ˜Žæ˜¾ï¼Œä½†æ—‹è½¬ä»ç„¶éœ€è¦ä¸€äº›è®¡ç®—ã€‚å½“ç„¶è¿™éš¾ä¸å€’ç²¾ç&nbsp;”å¤©æ–‡ç®—å­¦å¤šå¹´çš„èµµåšå£«ï¼Œ
è¿™é‡Œå¼¦å®žï¼ˆ$5\times5$ çš„æ­£æ–¹å½¢ï¼‰å¯ä»¥çœ‹ä½œæ˜¯é¡ºæ—¶é’ˆæ—‹è½¬å¾—åˆ°çš„ï¼Œä»Žæœ±å®žçš„ä¸‰è§’å½¢å®¹æ˜“
çœ‹å‡ºæ—‹è½¬çš„è§’åº¦æ­£å¥½æ˜¯ $\arctan(3/4)$ã€‚\Asy{} ä¸­ä¹Ÿå¯ä»¥æ–¹ä¾¿åœ°è°ƒç”¨è¿”å›žè§’åº¦çš„åä¸‰
è§’å‡½æ•° |aTan|\index{aTan@\lstinline=aTan=} æ¥è®¡ç®—è¿™ä¸ªè§’åº¦ã€‚æ›´è¯¦ç»†çš„æ•°å­¦å‡½æ•°åˆ—
è¡¨ï¼Œå‚çœ‹ \cite{asyman}ã€‚

äºŽæ˜¯ï¼Œèµµåšå£«å¼¦å›¾ä¸­çš„ç½‘æ&nbsp;¼ï¼Œå°±å¯ä»¥è¿™æ&nbsp;·æ–¹ä¾¿åœ°ç”»å‡ºæ¥äº†
ï¼ˆ\autoref{fig:xiantugrid}ï¼‰ï¼š
\begin{lstlisting}
// `\color{comment}ç½‘æ&nbsp;¼`
import math;
add( scale(1cm) * grid(7, 7, gray) );
add( shift(0,3cm) * rotate(-aTan(3/4)) * scale(1cm) * grid(5, 5, gray) );
// `\color{comment}å¼¦å›¾ä¸»ä½“`
fill( box((3cm,3cm), (4cm,4cm)), opacity(0.5)+yellow );
filldraw( (4cm,0) -- (4cm,3cm) -- (0,3cm) -- cycle
    ^^ (7cm,4cm) -- (4cm,4cm) -- (4cm,0) -- cycle
    ^^ (3cm,7cm) -- (3cm,4cm) -- (7cm,4cm) -- cycle
    ^^ (0,3cm) -- (3cm,3cm) -- (3cm,7cm) -- cycle,
    fillpen=opacity(0.1)+red, drawpen=red+0.5mm );
\end{lstlisting}
\begin{figure}[htbp]
\centering
\begin{asy}
// ç½‘æ&nbsp;¼
import math;
add( scale(1cm) * grid(7, 7, gray) );
add( shift(0,3cm) * rotate(-aTan(3/4)) * scale(1cm) * grid(5, 5, gray) );
// å¼¦å›¾ä¸»ä½“
fill( box((3cm,3cm), (4cm,4cm)), opacity(0.5)+yellow );
filldraw( (4cm,0) -- (4cm,3cm) -- (0,3cm) -- cycle
    ^^ (7cm,4cm) -- (4cm,4cm) -- (4cm,0) -- cycle
    ^^ (3cm,7cm) -- (3cm,4cm) -- (7cm,4cm) -- cycle
    ^^ (0,3cm) -- (3cm,3cm) -- (3cm,7cm) -- cycle,
    fillpen=opacity(0.1)+red, drawpen=red+0.5mm );
\end{asy}
\caption{å¸¦ç½‘æ&nbsp;¼çš„å¼¦å›¾è‰å›¾}
\label{fig:xiantugrid}
\end{figure}


\section{æ&nbsp;‡æ³¨æ–‡å­—}

\index{æ&nbsp;‡æ³¨}\index{æ&nbsp;‡ç­¾}
çŽ°åœ¨è¦è¿›è¡Œçš„æ˜¯æ–‡å­—çš„æ&nbsp;‡æ³¨ã€‚æŒ‰ç…§å‹¾è‚¡å®šç†çš„çº¦å®šï¼Œèµµåšå£«æ‰“ç®—åœ¨ä¸€ä¸ªçº¢è‰²ä¸‰è§’å½¢å†…æ&nbsp;‡
æ³¨â€œæœ±å®žâ€ï¼Œåœ¨é»„è‰²çŸ©å½¢å¤„æ&nbsp;‡æ³¨â€œé»„å®žâ€ï¼Œå¹¶ä¸ºæ‹¼å¾—çš„æ•´ä¸ªå¤§çŸ©å½¢æ&nbsp;‡æ³¨â€œå¼¦å®žâ€ï¼›åœ¨å¦
ä¸€çº¢è‰²ä¸‰è§’å½¢çš„ä¸‰è¾¹æ&nbsp;‡æ³¨â€œå‹¾ä¸‰â€ã€â€œè‚¡å››â€ã€â€œå¼¦äº”â€çš„å°ºå¯¸ï¼›æœ€åŽåœ¨å›¾å½¢ä¸¤ä¾§åŠ&nbsp;ä¸Š
è¯´æ˜Žçš„æ–‡å­—ã€‚

åœ¨æ&nbsp;‡æ³¨æ–‡å­—ä¹‹å‰ï¼Œå¯¹äºŽä¸­æ–‡æ&nbsp;‡ç­¾\index{æ&nbsp;‡ç­¾!ä¸­æ–‡æ&nbsp;‡ç­¾}ï¼Œåº”è¯¥å…ˆå®šä¹‰å¥½ä¸­æ–‡çŽ¯å¢ƒå’Œå­—ä½“
ã€‚\Asy{} ä¼šè°ƒç”¨ \LaTeX{} æ¥è¿›è¡Œæ&nbsp;‡ç­¾çš„å¤„ç†ï¼Œå›&nbsp;è€Œéœ€è¦è®¾ç½®çš„å°±æ˜¯ \LaTeX{} çš„ç¼–è¯‘
å¼•æ“Ž\index{LaTeX@\LaTeX!å¼•æ“Ž}ä¸Žä¸€èˆ¬çš„ä¸­æ–‡ \LaTeX{} æ–‡ä»¶å¯¼è¨€åŒºã€‚åœ¨è¿™é‡Œï¼Œèµµåšå£«å†³å®šä½¿
ç”¨ \XeTeX{}\index{XeTeX@\XeTeX} å¼•æ“Žä¸Ž
\prgname{xeCJK}\index{xeCJK@\prgname{xeCJK}} å®åŒ…æ¥å¤„ç†ä¸­æ–‡ã€‚ä¸ºæ­¤ï¼Œåœ¨ \Asy{} 
æºæ–‡ä»¶ä¸­ï¼Œä»–ä½¿ç”¨äº†ä¸‹é¢çš„è®¾ç½®ä»£ç&nbsp;ï¼š
\begin{lstlisting}
settings.tex = "xelatex";
usepackage("xeCJK");
texpreamble("\setCJKmainfont{SimSun}");
\end{lstlisting}
è¿™é‡Œç¬¬ä¸€è¡Œæ˜¯è®¾ç½®ç¼–è¯‘æ—¶æ‰€ç”¨çš„ \TeX{} å¼•æ“Žã€‚åŽé¢
|usepackage|\index{usepackage@\lstinline=usepackage=} å‘½ä»¤å°±æ˜¯ \LaTeX{} ä¸­çš„
\texcode|\usepackage| å‘½ä»¤çš„ä¸€ä¸ªåŒ…è£…å½¢å¼ï¼Œé‡Œé¢çš„å­—ç¬¦ä¸²å‚æ•°å°±æ˜¯å®åŒ…åï¼›è€Œ
|texpreamble|\index{texpreamble@\lstinline=texpreamble=} å‘½ä»¤åˆ™æŠŠæŽ¥æ”¶çš„å‚æ•°ç›´
æŽ¥æ”¾è¿› \LaTeX{} çš„å¯¼è¨€åŒºã€‚

è¿›è¡Œä¸Šè¿°è®¾ç½®åŽï¼Œå°±å¯ä»¥æ­£ç¡®ä½¿ç”¨ä¸­æ–‡æ&nbsp;‡ç­¾äº†ã€‚æ&nbsp;‡æ³¨çš„å‘½ä»¤å¾ˆç®€å•ï¼Œå°±æ˜¯
|label|\index{label@\lstinline=label=}ï¼Œå‚æ•°æ­£æ˜¯æ&nbsp;‡ç­¾æ–‡å­—å’Œæ&nbsp;‡ç­¾çš„ä½ç½®ã€‚ä¾‹å¦‚ï¼š
\begin{lstlisting}
draw( (0,0) -- (1cm,1cm) -- (2cm,0) );
label( "`\color{string}ä¸­é—´`", (1cm,0cm) );
\end{lstlisting}
å°±å¾—åˆ°
\begin{figure}[H]
\centering
\begin{asy}
settings.tex = "xelatex";
usepackage("xeCJK");
texpreamble("\setCJKmainfont{SimSun}");
draw( (0,0) -- (1cm,1cm) -- (2cm,0) );
label( "ä¸­é—´", (1cm,0cm) );
\end{asy}
\end{figure}

å¯ä»¥åœ¨æ&nbsp;‡ç­¾ä¸­ä½¿ç”¨ä»»æ„çš„ \LaTeX{} ä»£ç&nbsp;ï¼ŒåŒ…æ‹¬æ•°å­¦å…¬å¼ï¼Œä¾‹å¦‚ï¼š
\begin{lstlisting}
label("$x = \sin\alpha$", (0,0));
\end{lstlisting}
å°±ä¼šæ­£ç¡®åœ°å¾—åˆ° $x = \sin\alpha$ çš„æ&nbsp;‡ç­¾ã€‚

çŽ°åœ¨ï¼Œæˆ‘ä»¬å¯ä»¥ç»™å¼¦å›¾åŠ&nbsp;ä¸Šâ€œæœ±å®žâ€ã€â€œé»„å®žâ€å’Œâ€œå¼¦å®žâ€çš„æ&nbsp;‡ç­¾äº†ã€‚åœ¨å‰é¢çš„æ¡†æž¶ä»£
ç&nbsp;åŽé¢åŠ&nbsp;ä¸Š
\begin{lstlisting}
label("`\color{string}æœ±å®ž`", (2cm,4cm));
label("`\color{string}é»„å®ž`", (3.5cm,3.5cm));
label("`\color{string}å¼¦å®ž`", (5cm,4cm));
\end{lstlisting}
ä»¥åŠè®¾ç½®å­—ä½“çš„ä»£ç&nbsp;ï¼Œå°±å¾—åˆ°\autoref{fig:xiantupartlabel} çš„ç»“æžœã€‚
\begin{figure}
\centering
\begin{asy}
settings.tex = "xelatex";
usepackage("xeCJK");
texpreamble("\setCJKmainfont{SimSun}");
import math;
add( scale(1cm) * grid(7, 7, gray) );
add( shift(0,3cm) * rotate(-aTan(3/4)) * scale(1cm) * grid(5, 5, gray) );
fill( box((3cm,3cm), (4cm,4cm)), opacity(0.5)+yellow );
filldraw( (4cm,0) -- (4cm,3cm) -- (0,3cm) -- cycle
    ^^ (7cm,4cm) -- (4cm,4cm) -- (4cm,0) -- cycle
    ^^ (3cm,7cm) -- (3cm,4cm) -- (7cm,4cm) -- cycle
    ^^ (0,3cm) -- (3cm,3cm) -- (3cm,7cm) -- cycle,
    fillpen=opacity(0.1)+red, drawpen=red+0.5mm );
label("æœ±å®ž", (2cm,4cm));
label("é»„å®ž", (3.5cm,3.5cm));
label("å¼¦å®ž", (5cm,4cm));
\end{asy}
\caption{å¸¦éƒ¨åˆ†æ&nbsp;‡æ³¨çš„å¼¦å›¾}\label{fig:xiantupartlabel}
\end{figure}

ä¸‹é¢åˆ™æ˜¯è¦ç»™ä¸‰è§’å½¢çš„ä¸‰è¾¹è¿›è¡Œæ&nbsp;‡æ³¨ã€‚

\index{æ&nbsp;‡ç­¾!è·¯å¾„ä¸Šçš„æ&nbsp;‡ç­¾}
ä¸Žå‰é¢åœ¨ä¸€ä¸ªç‚¹å¤„æ&nbsp;‡æ³¨ä¸åŒï¼Œè¿™é‡Œå®žé™…æ˜¯ç»™ä¸€æ¡è·¯å¾„ï¼ˆç›´çº¿ï¼‰æ&nbsp;‡æ³¨æ&nbsp;‡ç­¾ã€‚å›&nbsp;æ­¤ï¼Œæƒ³è¦å¾—
åˆ°çš„æ˜¯è·ç¦»è¿™æ¡è·¯å¾„çš„ä¸­ç‚¹ä¸€å®šæ–¹å‘è·ç¦»åŠ&nbsp;ä¸€ä¸ªæ&nbsp;‡ç­¾ï¼Œè€Œä¸æ˜¯ç®€å•åœ°å–è·¯å¾„ä¸Šçš„ä¸€ç‚¹ä½œ
ä¸ºæ&nbsp;‡ç­¾çš„ä½ç½®ã€‚å¥½åœ¨ \Asy{} ç¡®å®žä¹Ÿæä¾›äº†è¿™æ&nbsp;·çš„åŠŸèƒ½ï¼Œä»ç„¶ä½¿ç”¨ |label| å‘½ä»¤ï¼ŒåŸºæœ¬
è¯­æ³•æ˜¯ï¼š\index{label@\lstinline=label=}
\begin{lstlisting}
label(`æ&nbsp;‡ç­¾`, `è·¯å¾„`)
\end{lstlisting}
è¿™é‡Œé»˜è®¤ä¼šåœ¨è·¯å¾„ä¸­é—´çš„å³ä¾§ï¼ˆæ²¿ç€è·¯å¾„è¡Œè¿›æ–¹å‘ï¼‰åŠ&nbsp;æ&nbsp;‡ç­¾ã€‚ä¾‹å¦‚ï¼š
\begin{lstlisting}
draw( (0,0) -- (4cm,2cm), linewidth(0.5mm) );
label("ç²—çº¿æ¡", (0,0) -- (4cm,2cm));
\end{lstlisting}
ï¼ˆå…¶ä¸­çš„ |linewidth|\index{linewidth@\lstinline=linewidth=} å‡½æ•°ç”¨æ¥è¡¨ç¤ºå…·æœ‰
ä¸€å®šçº¿å®½\index{çº¿å®½}çš„ç”»ç¬”ï¼‰è¿™æ®µä»£ç&nbsp;å°†å¾—åˆ°
\begin{figure}[H]
\centering
\begin{asy}
settings.tex = "xelatex";
usepackage("xeCJK");
texpreamble("\setCJKmainfont{SimSun}");
draw( (0,0) -- (4cm,2cm), linewidth(0.5mm) );
label("ç²—çº¿æ¡", (0,0) -- (4cm,2cm));
\end{asy}
\end{figure}

çŽ°åœ¨ï¼Œèµµåšå£«å°±å¯ä»¥ç»™ä¸‰è§’å½¢çš„ä¸‰è¾¹åŠ&nbsp;ä¸Šâ€œå‹¾ä¸‰â€ã€â€œè‚¡å››â€ã€â€œå¼¦äº”â€çš„æ&nbsp;‡ç­¾äº†ï¼Œåª
è¦ç¨ç¨æ³¨æ„ä¸€ä¸‹æ&nbsp;‡ç­¾æ‘†æ”¾çš„é»˜è®¤æ–¹å‘ï¼š
\begin{lstlisting}
filldraw( (4cm,0) -- (4cm,3cm) -- (0,3cm) -- cycle,
    fillpen=opacity(0.1)+red, drawpen=red+0.5mm );
label( "å‹¾ä¸‰", (4cm,3cm) -- (4cm,0) );
label( "è‚¡å››", (0,3cm) -- (4cm,3cm) );
label( "å¼¦äº”", (4cm,0) -- (0,3cm) );
\end{lstlisting}
\begin{figure}[H]
\centering
\begin{asy}
settings.tex = "xelatex";
usepackage("xeCJK");
texpreamble("\setCJKmainfont{SimSun}");
filldraw( (4cm,0) -- (4cm,3cm) -- (0,3cm) -- cycle,
    fillpen=opacity(0.1)+red, drawpen=red+0.5mm );
label( "å‹¾ä¸‰", (4cm,3cm) -- (4cm,0) );
label( "è‚¡å››", (0,3cm) -- (4cm,3cm) );
label( "å¼¦äº”", (4cm,0) -- (0,3cm) );
\end{asy}
\end{figure}

ä¸è¿‡ï¼Œä¸ºäº†å¾—åˆ°æ­£ç¡®çš„æ&nbsp;‡ç­¾ä½ç½®ï¼Œä¸å¾—ä¸æŠŠåŽŸæ¥é€†æ—¶é’ˆç”»çš„çº¿ç”¨é¡ºæ—¶é’ˆæ–¹å‘é‡å†™ï¼Œè¿™å¤š
å°‘è®©èµµåšå£«æœ‰äº›æ¼ç«ï¼šä¸ºä»€ä¹ˆä¸èƒ½åœ¨è·¯å¾„çš„å·¦è¾¹æ&nbsp;‡æ³¨æ&nbsp;‡ç­¾å‘¢ï¼Ÿç¡®å®žå¯ä»¥ï¼Œå¾ˆç®€å•ï¼Œåªè¦
ç»™ |label| å‘½ä»¤å†åŠ&nbsp;ä¸Š |align=LeftSide|\index{align@\lstinline=align=}
\index{LeftSide@\lstinline=LeftSide=} é€‰é¡¹ï¼ˆæˆ–è€…ç®€å•åœ°åªç”¨ |LeftSide|ï¼‰å°±æŒ‡å®š
äº†åœ¨å·¦è¾¹æ”¾ç½®å¯¹é½ã€‚åŒç†ï¼Œè¿˜æœ‰å‘å³å¯¹é½çš„
|RightSide|\index{RightSide@\lstinline=RightSide=}ï¼Œåœ¨ä¸­é—´å¯¹é½çš„
|Center|\index{Center@\lstinline=Center=} ä»¥åŠä¸€èˆ¬æ„ä¹‰çš„ç›¸å¯¹æ–¹å‘
\lstinline[mathescape]|Relative($\text{æ–¹å‘}$)|ã€‚%
\index{Relative@\lstinline=Relative=}%
ä¾‹å¦‚ï¼š
\begin{lstlisting}
draw( (0,0) -- (4cm,2cm), blue, Arrow );
label( "LeftSide", (0,0) -- (4cm,2cm), align=LeftSide );
label( "RightSide", (0,0) -- (4cm,2cm), align=RightSide );
label( "Center", (0,0) -- (4cm,2cm), align=Center );

draw( (6cm,0)--(8cm,2cm), blue, Arrow );
label( "E", (6cm,0)--(8cm,2cm), Relative(E) );
label( "S", (6cm,0)--(8cm,2cm), Relative(S) );
label( "W", (6cm,0)--(8cm,2cm), Relative(W) );
label( "N", (6cm,0)--(8cm,2cm), Relative(N) );
\end{lstlisting}
\begin{figure}[H]
\centering
\begin{asy}
draw( (0,0) -- (4cm,2cm), blue, Arrow );
label( "LeftSide", (0,0) -- (4cm,2cm), align=LeftSide );
label( "RightSide", (0,0) -- (4cm,2cm), align=RightSide );
label( "Center", (0,0) -- (4cm,2cm), align=Center );

draw( (6cm,0)--(8cm,2cm), blue, Arrow );
label( "E", (6cm,0)--(8cm,2cm), Relative(E) );
label( "S", (6cm,0)--(8cm,2cm), Relative(S) );
label( "W", (6cm,0)--(8cm,2cm), Relative(W) );
label( "N", (6cm,0)--(8cm,2cm), Relative(N) );
\end{asy}
\end{figure}
|E|, |S|, |W|, |N|\index{E@\lstinline=E=}\index{S@\lstinline=S=}
\index{W@\lstinline=W=}\index{N@\lstinline=N=} åˆ†åˆ«æ˜¯ä¸œå—è¥¿åŒ—å››ä¸ªç½—ç›˜æ–¹å‘ï¼Œ%
\index{ç½—ç›˜æ–¹å‘}ç”¨åœ¨ |Relative| å‡½æ•°é‡Œé¢å°±è¡¨ç¤ºç›¸å¯¹äºŽè·¯å¾„æ–¹å‘çš„å››ä¸ªæ–¹å‘ã€‚ä¸ºæ˜Ž
ç¡®ï¼Œè¿™é‡Œç”¨ |Arrow|\index{Arrow@\lstinline=Arrow=} é€‰é¡¹åœ¨ç”»çº¿æ—¶åŠ&nbsp;äº†ç®­å¤´ã€‚
\index{ç®­å¤´}

ä¸è¿‡ï¼Œè¿™æ&nbsp;·çš„æ&nbsp;‡ç­¾è¿˜æ˜¯ä¸èƒ½ä»¤èµµåšå£«æ»¡æ„ã€‚èµµåšå£«ç»™ä¸‰è§’å½¢åŠ&nbsp;æ&nbsp;‡ç­¾ï¼Œè¿˜å¸Œæœ›æ&nbsp;‡ç­¾éšç€ä¸‰
è§’å½¢çš„è¾¹ä½œæ—‹è½¬ï¼Œä½¿æ&nbsp;‡ç­¾æ²¿ç€è¾¹æŽ’åˆ—ã€‚ä¸ºæ­¤ï¼Œèµµåšå£«ä¸å¾—ä¸åˆä»”ç»†æŸ¥çœ‹äº†
\cite{asyman}ï¼Œåœ¨è®²æ&nbsp;‡æ³¨æ–‡å­—ä¸€èŠ‚ï¼ˆlabelï¼‰ä»–æ‰¾åˆ°äº†ä¸€ä¸ªæž„é€&nbsp;æ&nbsp;‡ç­¾çš„æ›´é«˜çº§çš„åŠžæ³•ï¼Œ
å³ä¸ä»…ä»…æ˜¯ä½¿ç”¨ä¸€ä¸ªç®€å•çš„å­—ç¬¦ä¸²ï¼Œè€Œæ˜¯ä½¿ç”¨\index{Label@\lstinline=Label=}
\begin{lstlisting}
Label(`æ&nbsp;‡ç­¾`)
\end{lstlisting}
å‡½æ•°è¿›è¡Œæž„é€&nbsp;ã€‚é‡Œé¢çš„â€œæ&nbsp;‡ç­¾â€å‚æ•°ä»ç„¶å¯ä»¥æ˜¯åŽŸæ¥çš„å­—ç¬¦ä¸²ï¼Œæˆ–æ˜¯é€šè¿‡è¿™ä¸ªå‡½æ•°æž„é€&nbsp;
å‡ºæ¥çš„é«˜çº§çš„æ&nbsp;‡ç­¾ã€‚è¿™ä¸ªå‡½æ•°å¯ä»¥å¸¦è®¸å¤šå¯é€‰çš„å…¶ä»–å‚æ•°ï¼Œå¦‚
\lstinline[mathescape]|position=$\text{ä½ç½®}$|
\index{position@\lstinline=position=} çš„å‚æ•°å°±å¯ä»¥æŒ‡å®šæ&nbsp;‡ç­¾æ”¾åœ¨è·¯å¾„ä¸­ç‚¹ä¹‹å¤–çš„
å…¶ä»–åœ°æ–¹ï¼›è€Œ \lstinline[mathescape]|embed=$\text{åµŒå…¥å˜æ¢æ–¹å¼}$|
\index{embed@\lstinline=embed=} çš„å‚æ•°åˆ™å¯ä»¥è§£å†³æ&nbsp;‡ç­¾è‡ªåŠ¨æ—‹è½¬çš„é—®é¢˜ã€‚

è¿™é‡Œæš‚ä¸”æ”¾ä¸‹ |position| å‚æ•°ã€‚åªæ¥çœ‹ |embed| å‚æ•°çš„ä¸€ä¸ªç‰¹ä¾‹ï¼š%
\lstinline[mathescape]|Rotate($\text{æ–¹å‘}$)|%
\index{Rotate@\lstinline=Rotate=}ã€‚è¿™ä¸ªå‚æ•°ä¼šè®©æ&nbsp;‡ç­¾å‘ç€ç»™å®šçš„æ–¹å‘æ—‹è½¬ï¼Œå¦‚ï¼š
\begin{lstlisting}
draw( (0,0)--(4cm,2cm), blue, Arrow );
label( Label("Rotate", Rotate((4,2))),
    (0,0)--(4cm,2cm) );
\end{lstlisting}
\begin{figure}[H]
\centering
\begin{asy}
draw( (0,0)--(4cm,2cm), blue, Arrow );
label( Label("Rotate", Rotate((4,2))),
    (0,0)--(4cm,2cm) );
\end{asy}
\end{figure}
è¿™é‡Œåæ&nbsp;‡ $(4,2)$ æ­£æ˜¯è¿™æ¡ç›´çº¿çš„ç»˜åˆ¶æ–¹å‘ã€‚

ç»ˆäºŽï¼Œä½¿ç”¨äº†ä¸Šé¢çš„å…¨éƒ¨åŠŸèƒ½ï¼Œèµµåšå£«å®Œæˆäº†å…¨éƒ¨çš„å›¾å½¢æ&nbsp;‡æ³¨å·¥ä½œ
ï¼ˆ\autoref{fig:xiantulabel}ï¼‰ï¼š
\begin{lstlisting}
settings.tex = "xelatex";
usepackage("xeCJK");
texpreamble("\setCJKmainfont{SimSun}");

import math;
add( scale(1cm) * grid(7, 7, gray) );
add( shift(0,3cm) * rotate(-aTan(3/4)) * scale(1cm) * grid(5, 5, gray) );

fill( box((3cm,3cm), (4cm,4cm)), opacity(0.5)+yellow );
filldraw( (4cm,0) -- (4cm,3cm) -- (0,3cm) -- cycle
    ^^ (7cm,4cm) -- (4cm,4cm) -- (4cm,0) -- cycle
    ^^ (3cm,7cm) -- (3cm,4cm) -- (7cm,4cm) -- cycle
    ^^ (0,3cm) -- (3cm,3cm) -- (3cm,7cm) -- cycle,
    fillpen=opacity(0.1)+red, drawpen=red+0.5mm );

label("æœ±å®ž", (2cm,4cm));
label("é»„å®ž", (3.5cm,3.5cm));
label("å¼¦å®ž", (5cm,4cm));
label( Label("å‹¾ä¸‰",Rotate(S)), (4cm,0)--(4cm,3cm), LeftSide );
label( Label("è‚¡å››",Rotate(E)), (4cm,3cm)--(0,3cm), LeftSide );
label( Label("å¼¦äº”",Rotate((4,-3))), (0,3cm)--(4cm,0), LeftSide );
\end{lstlisting}
\begin{figure}[htbp]
\centering
\begin{asy}
settings.tex = "xelatex";
usepackage("xeCJK");
texpreamble("\setCJKmainfont{SimSun}");

import math;
add( scale(1cm) * grid(7, 7, gray) );
add( shift(0,3cm) * rotate(-aTan(3/4)) * scale(1cm) * grid(5, 5, gray) );

fill( box((3cm,3cm), (4cm,4cm)), opacity(0.5)+yellow );
filldraw( (4cm,0) -- (4cm,3cm) -- (0,3cm) -- cycle
    ^^ (7cm,4cm) -- (4cm,4cm) -- (4cm,0) -- cycle
    ^^ (3cm,7cm) -- (3cm,4cm) -- (7cm,4cm) -- cycle
    ^^ (0,3cm) -- (3cm,3cm) -- (3cm,7cm) -- cycle,
    fillpen=opacity(0.1)+red, drawpen=red+0.5mm );

label("æœ±å®ž", (2cm,4cm));
label("é»„å®ž", (3.5cm,3.5cm));
label("å¼¦å®ž", (5cm,4cm));
label( Label("å‹¾ä¸‰",Rotate(S)), (4cm,0)--(4cm,3cm), LeftSide );
label( Label("è‚¡å››",Rotate(E)), (4cm,3cm)--(0,3cm), LeftSide );
label( Label("å¼¦äº”",Rotate((4,-3))), (0,3cm)--(4cm,0), LeftSide );
\end{asy}
\caption{å¸¦æ&nbsp;‡æ³¨çš„å®Œæ•´å¼¦å›¾}
\label{fig:xiantulabel}
\end{figure}


\section*{ä¹&nbsp;é¢˜}

\begin{enumerate}
  \item æŸ¥é˜…å‚è€ƒæ‰‹å†Œ \cite{asyman}ï¼Œçœ‹çœ‹éƒ½æœ‰å“ªäº›é¢œè‰²å¯ç”¨ã€‚çœ‹çœ‹ä½&nbsp;çš„ç³»ç»Ÿä¸­å®‰è£…
    äº†å“ªäº›ä¸­æ–‡å­—ä½“ã€‚ç„¶åŽä¿®æ”¹\autoref{fig:xiantulabel}ï¼Œä½¿ç”¨å¦ä¸€ç§ä½&nbsp;å–œæ¬¢çš„å­—ä½“
    è¿›è¡Œæ&nbsp;‡æ³¨ï¼›å¹¶ä¸”å°†â€œæœ±å®žâ€ã€â€œé»„å®žâ€å’Œâ€œå¼¦å®žâ€åˆ†åˆ«ç”¨çº¢ã€é»„ã€æ©™è‰²æ&nbsp;‡æ³¨ã€‚

  \item æŸ¥é˜…å‚è€ƒæ‰‹å†Œ \cite{asyman}ï¼Œçœ‹çœ‹ |draw|ã€|fill|ã€|label| ç­‰å‘½ä»¤éƒ½å¯ä»¥
    å¸¦å“ªäº›å¯é€‰çš„å‚æ•°ï¼Œå¹¶è‡ªå·±ä¸¾ä¾‹å­è¯•éªŒä¸€ä¸‹æ•ˆæžœã€‚

  \item ä»£ç&nbsp;
\begin{lstlisting}
path zhushi = (4cm,0) -- (4cm,3cm) -- (0,3cm) -- cycle;
\end{lstlisting}
    å¯ä»¥æŠŠä¸€ä¸ªä¸‰è§’å½¢çš„è·¯å¾„ä¿å­˜åœ¨å˜é‡ |zhushi| ä¸­ï¼Œä»¥åŽå°±å¯ä»¥ä½¿ç”¨
    |draw(zhushi)| è¿™æ&nbsp;·çš„å‘½ä»¤å¯¹æ­¤è·¯å¾„è¿›è¡Œæ“ä½œäº†\footnote{å…³äºŽå˜é‡å®šä¹‰å’Œä½¿ç”¨çš„
    è¯¦ç»†å†…å®¹ï¼Œå‚è€ƒåŽé¢çš„ç«&nbsp;èŠ‚æˆ–æ‰‹å†Œ \cite{asyman}ã€‚}ã€‚

    è€ƒè™‘å¦‚ä½•åˆ©ç”¨å¹³ç§»å’Œæ—‹è½¬å˜æ¢ï¼Œåªå®šä¹‰ä¸€ä¸ªä¸‰è§’å½¢çš„è·¯å¾„ï¼Œå°±æŠŠå¼¦å›¾ä¸­çš„å››ä¸ªçº¢è‰²
    ä¸‰è§’å½¢éƒ½ç”»å‡ºæ¥ã€‚

  \item æŸ¥é˜…æ‰‹å†Œ \cite{asyman} å’Œ \Asy{} è‡ªå¸¦çš„ä¾‹å­ï¼Œç&nbsp;”ç©¶æ¨¡å—
    \prgname{roundedpath} çš„ç”¨æ³•ã€‚å¹¶åˆ©ç”¨å®ƒå°è¯•ç”»å‡ºä¸‹é¢çš„å›¾å½¢ï¼š
\begin{figure}[H]
\centering
\begin{asy}
import roundedpath;
pen thick = linewidth(0.8pt);
path p = (0,0) -- (0,2cm) -- (1cm,3.25cm) -- (2cm,2cm) -- (2cm,0)
	-- (0,2cm) -- (2cm, 2cm) -- (0,0) -- (2cm,0);
draw(roundedpath(p, 8pt), thick);
\end{asy}
\end{figure}

    çœ‹çœ‹ \Asy{} ä¸­è¿˜æœ‰ä»€ä¹ˆç”¨æ³•ç®€å•è€Œåˆæœ‰è¶£çš„æ¨¡å—ã€‚

  \item ï¼ˆè¾ƒéš¾ï¼‰ç&nbsp;”ç©¶åœ¨ \LaTeX{} é‡Œä¸­æ–‡ç›´æŽ’çš„æ–¹æ³•ï¼Œå°½é‡ç²¾ç¡®åœ°å¤çŽ°å‡ºèµµåšå£«ç†æƒ³
    ä¸­çš„å¼¦å›¾æ•ˆæžœï¼ˆ\autoref{fig:xiantu}ï¼‰ã€‚
\end{enumerate}

\endinput

% vim:tw=77:

</pre></body></html>