<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%  
%  \begin{funclist}
%  \item  A \go
%  BBBBBBBBBBBBBBBBBB
%  good luck good luck good luck good luck good luck good luck good luck good luck
%  good luck good luck good luck good luck good luck good luck good luck good luck
%  good luck good luck good luck good luck good luck good luck good luck good luck
%  
%  \item  BBB  \go
%  DDDDDDDDDDDDDD BBBBBBBBBBBBBBBBBB sd good luck 
%  good luck good luck good luck good luck good luck good luck good luck good luck
%  good luck good luck good luck good luck good luck good luck good luck good luck
%  \end{funclist}
%  
%  \begin{lstlisting}
%  size(10cm);
%  path a=(0,0)--(1,1);
%  draw(a,red);
%  //æŠ„å½•ä»£ç&nbsp;çŽ¯å¢ƒ
%  //comments
%  \end{lstlisting}
%  
\include{preamble_newnew}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{wasysym}

\newlength{\deffboxsep}
\setlength{\deffboxsep}{\fboxsep}

\newcommand{\qref}[1]{~\framebox{\bfseries é—®é¢˜\ref{#1}}~}
\newcommand{\myfig}[1]{\par{ \setlength{\fboxsep}{0pt}
     \centering\colorbox{yellow!10!white}{
     \parbox{0.9\textwidth}{\vspace{-2mm}\begin{center}\colorbox{white}{\includegraphics{figures/#1}}\end{center}\vspace{-2mm}}
     }\\\rule{0.92\textwidth}{0.3pt}\\[-3mm]
     \setlength{\fboxsep}{\deffboxsep} }}
\begin{document}
\title{\bfseries Asymptoteä¸­çš„å¸¸è§é—®é¢˜ï¼ˆFAQï¼‰}
\author{è¯‘è€…ï¼šgoodluck@bbs.ctex.org}
\maketitle
\begin{center}
\colorbox{gray!30!white}{\parbox{0.9\textwidth}{
{\bfseries è¯´æ˜Žï¼š}
\begin{itemize}
\item è‹±æ–‡åŽŸç‰ˆFAQè¯·å‚è§ \url{http://asymptote.sourceforge.net/FAQ/}ã€‚
\item å¯¹åº”1.57ç‰ˆæ—¶çš„FAQï¼Œä¸è¿‡FAQéšç‰ˆæœ¬å˜åŠ¨ä¸å¤§\raisebox{-1pt}{\Large\smiley}ã€‚
\item ç›´è¯‘æ„è¯‘ç»“åˆï¼Œå°½é‡ä¿æŒåŽŸæ„ï¼›ä¸ºé¿å…æ··æ·†ï¼Œæœ‰äº›è¯æ¯”å¦‚pictureç­‰æœ‰æ—¶æ²¡æœ‰ç¿»è¯‘ã€‚
\item ä¸ºäº†æ–¹ä¾¿ç†è§£ï¼Œèƒ½ç”Ÿæˆå›¾çš„ä»£ç&nbsp;éƒ½é™„æœ‰å…¶ç”Ÿæˆçš„å›¾å½¢ã€‚
\item æŽ’ç‰ˆç»†èŠ‚ä¸Šï¼Œæœ‰äº›ä¸ä¸€è‡´çš„åœ°æ–¹ï¼Œè¯·è¯»è€…è§è°…ã€‚
\item è„šæ³¨ä¸ºè¯‘è€…çš„ä¸€äº›ç†è§£ï¼Œä»…ä¾›å‚è€ƒã€‚
\item ç”±äºŽè¯‘è€…è°æ°´å¹³æœ‰é™ï¼Œç¿»è¯‘ä¸å‡†ç”šè‡³é”™è¯¯çš„åœ°æ–¹åœ¨æ‰€éš¾å…ï¼Œæ¬¢è¿Žå¤§å®¶æŒ‡æ­£ã€‚
\item é‡ç‚¹æ„Ÿè°¢CTEXè®ºå›ä¸Š cvgmt å’Œ milksea æä¾›çš„èµ„æºä»¥åŠæœ‰ç›Šè®¨è®ºå’Œå¸®åŠ©ã€‚
\end{itemize}
}}
\end{center}

\section{\label{Q1}å…³äºŽAsymptote}
\subsection{\label{Q1.1}ä»€ä¹ˆæ˜¯Asymptote}
Asymptoteæ˜¯ä¸€ç§ä¸ºäº†ç»˜åˆ¶æŠ€æœ¯å›¾å½¢è€Œè®¾è®¡çš„çŸ¢é‡å›¾è¯­è¨€ï¼Œå…¶çµæ„Ÿæ¥è‡ªMetaPostï¼Œå®ƒå…·æœ‰IEEEæ&nbsp;‡å‡†çš„æµ®ç‚¹æ•°æ”¯æŒã€åŽŸç”Ÿçš„ä¸‰ç»´å›¾å½¢æ”¯æŒã€
ç°åº¦/RGB/CMYKç­‰ä¸åŒè‰²å½©æŒ‡å®šæ–¹å¼ä»¥åŠç±»ä¼¼C++çš„è¯­æ³•ã€‚ä¸ŽMetaPostä¸åŒï¼ŒAsymptoteåŽŸç”Ÿçš„æ”¯æŒå¤šæ®µè·¯å¾„
ï¼ˆå›&nbsp;æ­¤ä¸å±€é™äºŽå•è¿žé€šåŒºåŸŸï¼‰ã€å¡«å……å›¾æ¡ˆã€Gouraud ç€è‰²ï¼ˆshadingï¼‰ä»¥åŠPostScriptå›¾åƒã€‚

\subsection{\label{Q1.2}å¦‚ä½•èŽ·å¾—Asymptoteï¼Ÿ}
å®Œæ•´çš„æºä»£ç&nbsp;ä»¥åŠåŸºäºŽLinuxã€MacOS Xä»¥åŠå¾®è½¯Windowså¹³å°çš„äºŒè¿›åˆ¶ä»£ç&nbsp;éƒ½å¯ä»¥åœ¨ç½‘å€
\url{http://asymptote.sourceforge.net/}æ‰¾åˆ°ã€‚è®¸å¤šLinuxå‘è¡Œç‰ˆï¼ˆæ¯”å¦‚RedHatå’ŒDebianï¼‰
å·²ç»åŒ…å«æœ‰Asymptoteè½¯ä»¶åŒ…ï¼ˆè¿›ä¸€æ­¥ä¿¡æ¯è¯·å‚è€ƒä½&nbsp;æ‰€ä½¿ç”¨å‘è¡Œç‰ˆçš„æ–‡æ¡£ï¼‰ã€‚

\subsection{\label{Q1.3}æˆ‘åœ¨å“ªé‡Œèƒ½é—®å…³äºŽAsymptoteçš„é—®é¢˜ï¼Ÿ}
å¦‚æžœæ‚¨æœ‰ç–‘é—®ï¼Œè¯·å°è¯•ä»Žè¿™ä¸ªâ€œå¸¸è§é—®é¢˜â€å¯»æ‰¾ç­”æ¡ˆï¼Œå¦‚æžœä¸è¡Œçš„è¯å¯ä»¥å‚è€ƒæ‰©å±•æ–‡æ¡£
\url{http://asymptote.sourceforge.net/doc/}æˆ–æœç´¢è®ºå›ï¼š
\url{http://sourceforge.net/forum/forum.php?forum_id=409349}ã€‚

\subsection{\label{Q1.4}ä¸ºä»€ä¹ˆé€‰æ‹©Asymptote\protect\footnotemark ä½œä¸ºåå­—ï¼Ÿ}
\footnotetext{è¯‘è€…æ³¨ï¼šasymptoteåœ¨è‹±è¯­ä¸­ä¸ºâ€œæ¸è¿‘çº¿â€çš„æ„æ€ã€‚}
å›&nbsp;ä¸ºå®ƒè¿˜ä¸æ˜¯ä¸€ä¸ªå®Œç¾Žçš„å›¾å½¢åŒ…ï¼Œä½†æ˜¯æˆ‘ä»¬ç¡®å®žå¸Œæœ›å®ƒæ¸è¿›çš„è¶‹äºŽå®Œç¾Žâ€¦â€¦

\subsection{\label{Q1.5}åœ¨Asymptoteçš„å†…éƒ¨æºä»£ç&nbsp;ä¸­ï¼Œcampè¿™ä¸ªåå­—æŒ‡çš„æ˜¯ä»€ä¹ˆï¼Ÿ}
é‚£æ˜¯æˆ‘ä»¬åœ¨Asymptoteè¿™ä¸ªé¡¹ç›®ä¸­æœ€åˆå–çš„ä¸€ä¸ªæµ‹è¯•ç”¨çš„åå­—ï¼Œå®ƒä»£è¡¨â€œC's Answer to MetaPostâ€\footnote{%
è¯‘è€…æ³¨ï¼šç¿»è¯‘æˆä¸­æ–‡å°±æ˜¯â€œMetaPosté—®é¢˜çš„Cè¯­è¨€ç­”æ¡ˆâ€}ï¼ˆAsymptoteçš„çµæ„Ÿæ¥æºäºŽMetaPostè¯­è¨€ï¼‰ã€‚
ä¸è¿‡ï¼Œæˆ‘ä»¬æœ€ç»ˆå†³å®šç”¨Asymptoteè¿™ä¸ªåå­—ï¼Œå›&nbsp;ä¸ºå®ƒæ›´å¥½çš„å¼ºè°ƒäº†è¿™ä¸ªè¯­è¨€çš„æ•°å­¦åŠå›¾å½¢æœ¬è´¨ã€‚

\section{\label{Q2}å…³äºŽå®‰è£…å’Œè®¾ç½®çš„é—®é¢˜}
\subsection{\label{Q2.1}èƒ½åœ¨MacOS Xä¸Šå®‰è£…Asymptoteå—ï¼Ÿ}
å¾ˆç®€å•ï¼Œä»Ž~\url{http://sourceforge.net/project/showfiles.php?group_id=120000}èŽ·å–æºä»£ç&nbsp;å¹¶ç›´æŽ¥ç¼–è¯‘å³å¯ã€‚
æˆ‘ä»¬æŽ¨èæ‚¨é¦–å…ˆå°†æ‚¨çš„GNU readlineåº“æ›´æ–°åˆ°æœ€æ–°ï¼Œé™¤éžæ‚¨ä¸éœ€è¦readlineæä¾›çš„äº¤äº’å¼æ”¯æŒï¼ˆå®‰è£…æ—¶configureä¼šè‡ªåŠ¨
æ£€æµ‹å¹¶ç¦ç”¨è¿‡æ—¶çš„readlineåº“ç‰ˆæœ¬ï¼‰ã€‚Marius Schamschulaä¹Ÿç»´æŠ¤ç€ä¸€ä¸ªé€‚ç”¨äºŽå„ç§MacOS Xå¹³å°çš„äºŒè¿›åˆ¶åŒ…
\url{http://www.hmug.org/pub/MacOS_X/X/Applications/Publishing/asymptote}ã€‚

\subsection{\label{Q2.2}å½“æˆ‘ç”¨äºŒè¿›åˆ¶åŒ…åœ¨MAC OSä¸Šå®‰è£…Asymptoteæ—¶ï¼Œä¸ºä»€ä¹ˆå¾—åˆ°è¿™æ&nbsp;·ä¸€ä¸ªé”™è¯¯ï¼šBad CPU type in executableï¼Ÿ}
è¿™æ„å‘³ç€è¦ä¹ˆä½&nbsp;çš„äºŒè¿›åˆ¶åŒ…æ˜¯é€‚ç”¨äºŽå¦ä¸€MACä½“ç³»ç»“æž„çš„ï¼Œè¦ä¹ˆï¼ˆæ&nbsp;¹æ®Marius Schamschulaçš„è§£é‡Šï¼‰æ˜¯ä½&nbsp;ç¼ºå°‘æŸä¸ªåº“ã€‚
æœ€ç®€å•çš„è§£å†³åŠžæ³•æ˜¯ç›´æŽ¥ä»Žå®˜æ–¹æº~\url{http://sourceforge.net/project/showfiles.php?group_id=120000}èŽ·å¾—
å¹¶ç¼–è¯‘æºä»£ç&nbsp;ã€‚

\subsection{\label{Q2.3}å½“æˆ‘ç”¨./configure --enable-gc=systemè¿›è¡Œé…ç½®æ—¶ï¼Œä¸ºä»€ä¹ˆå¾—åˆ°è¿™ä¸ªé”™è¯¯ï¼š can't locate file for: -lgccpp ï¼Ÿ}
è¿™è¯´æ˜Žä½&nbsp;ç³»ç»Ÿé‡Œçš„Boehmåžƒåœ¾å›žæ”¶å™¨ç‰ˆæœ¬ä¸å®Œæ•´ã€‚è¯·æ&nbsp;¹æ®INSTALLæ–‡ä»¶ä¸­çš„æŒ‡ä»¤åŽ»åšï¼šä»Ž~\url{http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source}
èŽ·å¾—æœ€æ–°çš„gcç‰ˆæœ¬ï¼Œå¹¶æŠŠå®ƒæ”¾åˆ°Asymptoteæºä»£ç&nbsp;ç›®å½•çš„æœ€ä¸Šå±‚ï¼Œç„¶åŽ ./configure ï¼ˆä¸è¦åŠ&nbsp; --enable-gc=system é€‰é¡¹ï¼‰ã€‚

\subsection{\label{Q2.4}å¦‚æžœå‡ºçŽ°è¿™ä¸ªé”™è¯¯æ€Žä¹ˆåŠžï¼šError: pdfetex (file pdftex.cfg): 
cannot open config files...texinfo.tex appears to be broken}
åªéœ€æŠŠ~\url{http://asymptote.sourceforge.net/asymptote.pdf}æ”¾åˆ°docç›®å½•ä¸‹ç„¶åŽé‡å¤æ‰§è¡Œmake allã€‚
æˆ–è€…å¦‚æžœä½&nbsp;ä¸æƒ³åˆ›å»ºæœ¬åœ°æ–‡æ¡£ï¼Œåªéœ€è¿›è¡Œ make install-asyã€‚

\subsection{\label{Q2.5}å¦‚æžœå¾—åˆ°è¿™ä¸ªé”™è¯¯æ€Žä¹ˆåŠžï¼š! Undefined control sequence. l.6 @copying?}
è¦ä¹ˆå‡çº§ä½&nbsp;çš„texinfoåŒ…ï¼Œè¦ä¹ˆæŒ‰\qref{Q2.4}ä¸­çš„æ–¹æ³•ç®€å•å¤„ç†ã€‚

\subsection{\label{Q2.6}èƒ½æŠŠAsymptoteé›†æˆåˆ° LaTeX ä¸­å—ï¼Ÿ}
å¯ä»¥ï¼Œè¯·å‚è€ƒä¾‹å­latexusage.texã€‚Dario Teixeira ä¹Ÿå†™äº†ä¸€ä¸ªå…³äºŽæ­¤è¯é¢˜çš„è¯¦ç»†æŒ‡å¯¼ã€‚ä½&nbsp;å¯ä»¥ä»Ž
\url{http://dario.dse.nl/projects/asylatex/}ä¸‹è½½åˆ°ã€‚

Philippe Ivaldi ä¸ºEmacsç”¨æˆ·æä¾›äº†ä¸€ä¸ªAsymptoteæ¨¡å¼~\url{http://asymptote.sourceforge.net/doc/Editing-modes.html}ï¼Œå®ƒ
åŒ…å«ä¸€ä¸ªlasy-modeï¼Œå…è®¸ç”¨æˆ·ä¸€æ¬¡ç¼–è¯‘ä¸€ä¸ª~\verb|\begin{asy}...\end{asy}|~çŽ¯å¢ƒå¹¶æŸ¥çœ‹ç»“æžœã€‚

\subsection{\label{Q2.7}èƒ½æŠŠAsymptoteé›†æˆåˆ°latexæˆ–pdflatex ä¸­å—ï¼Ÿ}
æ˜¯çš„ï¼Œè‡ªä»Ž1.14ç‰ˆæœ¬èµ·ï¼ŒAsymptoteå°±å¼€å§‹æ”¯æŒlatexå’Œpdflatexï¼ˆEPS/PDFå’Œå†…åµŒæ¨¡å¼éƒ½æ”¯æŒï¼‰ï¼Œå¦‚ä¾‹å­ latexusage.texä¸­æ‰€ç¤ºï¼š
\begin{verbatim}
pdflatex latexusage
asy latexusage
pdflatex latexusage
\end{verbatim}

\subsection{\label{Q2.8}å½“æˆ‘å®‰è£…Asymptoteçš„rpmäºŒè¿›åˆ¶åŒ…æ—¶æ˜¯å¦éœ€è¦tkinteråŒ…ï¼Ÿ}
ä¸éœ€è¦tkinteråŒ…ï¼Œé™¤éžä½&nbsp;æƒ³å°è¯•å›¾å½¢ç•Œé¢xasyã€‚è¯·å°è¯•
\begin{verbatim}
rpm -Uvh --nodeps asymptote-x.xx-1.i386.rpm
\end{verbatim}
å…¶ä¸­ x.xx ä»£è¡¨ç‰ˆæœ¬å·ã€‚ 

\subsection{\label{Q2.9}è·¯å¾„ \%USERPROFILE\%$\backslash$.asy$\backslash$config.asy æ˜¯ä»€ä¹ˆæ„æ€ï¼Ÿ}
é‚£æ˜¯å¾®è½¯Windowså¯¹ç”¨æˆ·é…ç½®ç›®å½•çš„å¼•ç”¨ã€‚è¿™ä¸ªå®žåœ¨æ²¡ä»€ä¹ˆéœ€è¦äº†è§£çš„ï¼Œåªéœ€è¦æŠŠä½&nbsp;çš„é…ç½®å‘½ä»¤
å†™å…¥æ–‡ä»¶config.asyå¹¶å°†è¯¥æ–‡ä»¶æ”¾å…¥ä¸€ä¸ªæ–°çš„ç›®å½•~\verb|%USERPROFILE%\.asy|~ä¸­å³å¯ã€‚

\subsection{\label{Q2.10}å½“æˆ‘å°è¯•è®¾ç½® settings.dir="C:$\backslash$asymptote$\backslash$"; æ—¶ä¸ºä»€ä¹ˆå¾—åˆ°é”™è¯¯ 
       "string not terminated"ï¼Ÿ}
è¿™é‡Œåæ–œæ&nbsp;æ˜¯ä¸€ä¸ªè½¬ä¹‰å­—ç¬¦ï¼Œå›&nbsp;æ­¤ \verb|\"| è§£é‡Šä¸ºå¼•å·æœ¬èº«ï¼Œå¯¼è‡´å­—ç¬¦ä¸²æ²¡æœ‰ç»“æŸçš„åŒå¼•å·ï¼Œå¹¸è¿çš„æ˜¯ï¼Œåæ–œæ&nbsp;æ˜¯
ç”¨åŒå¼•å·å®šç•Œçš„å­—ç¬¦ä¸²ä¸­å”¯ä¸€çš„è½¬ä¹‰å­—ç¬¦ã€‚è¿™é‡Œï¼Œæœ€åŽçš„é‚£ä¸ªåæ–œæ&nbsp;æ˜¯ä¸éœ€è¦çš„ï¼Œä½†å¦‚æžœä½&nbsp;ç¡®å®žéœ€è¦ä¸€ä¸ªåæ–œæ&nbsp;ï¼Œå¯ä»¥
è¿™æ&nbsp;·å†™ï¼š\verb|settings.dir="C:\asymptote"+'\\';|ã€‚

\subsection{\label{Q2.11}åœ¨å¾®è½¯Windowsä¸‹æˆ‘å¦‚ä½•æ”¹å˜çŽ¯å¢ƒå˜é‡ï¼Œæ¯”å¦‚ï¼Œè¦å¦‚ä½•æ”¹å˜é»˜è®¤çš„PostScriptæŸ¥çœ‹å™¨ï¼Ÿ}
å…¶å®žåœ¨ä½&nbsp;çš„config.asyæ–‡ä»¶ä¸­è®¾ç½®ç›¸åº”çš„Asymptoteé…ç½®å˜é‡ä¼šæ›´å®¹æ˜“ä¸€äº›ã€‚å¦‚æžœè¦æ”¹å˜WindowsçŽ¯å¢ƒå˜é‡ï¼Œå¯æŒ‰å¦‚ä¸‹æ­¥éª¤ï¼š
\begin{itemize}
\item å³å‡»â€œæˆ‘çš„ç”µè„‘â€
\item ä»Žå¼¹å‡ºèœå•ä¸­é€‰æ‹©å±žæ€§
\item å•å‡»â€œé«˜çº§â€æ&nbsp;‡ç­¾
\item å•å‡»â€çŽ¯å¢ƒå˜é‡â€œæŒ‰é’®
\end{itemize}

\subsection{\label{Q2.12}åœ¨å¾®è½¯Windows XPä¸‹ï¼Œä¸ºä»€ä¹ˆæˆ‘å¾—åˆ°è¿™æ&nbsp;·çš„é”™è¯¯ï¼š"Invalid Parameter - 432x432"ï¼Ÿ}
è¿™æ„å‘³ç€ImageMagickæ²¡æœ‰å®‰è£…æ­£ç¡®ï¼Œä½&nbsp;åœ¨ä½¿ç”¨çš„æ˜¯MSDOSçš„covertç¨‹åºè€Œä¸æ˜¯ImageMagickä¸­çš„convertã€‚
ä¹Ÿæœ‰å¯èƒ½è™½ç„¶ä½&nbsp;æ­£ç¡®å®‰è£…äº†ImageMagickå´æ˜¯åœ¨ä¸€ä¸ªçŽ°æœ‰çš„MSDOSçª—å£ä¸­è¿è¡Œçš„Asymptoteã€‚å¦‚æžœæ˜¯è¿™ç§æƒ…å†µï¼Œ
åªéœ€æ‰“å¼€ä¸€ä¸ªæ–°çª—å£é‡è¯•ã€‚å¦‚æžœè¿˜ä¸è¡Œï¼Œè¯·æ£€æŸ¥å¦‚ä¸‹å‘½ä»¤
\begin{verbatim}
convert --version
\end{verbatim}
æ˜¯å¦è¿”å›žç±»ä¼¼è¿™æ&nbsp;·çš„ä¿¡æ¯ï¼š Version: ImageMagick 6.2.8 06/27/06 Q16 http://www.imagemagick.org ã€‚

\subsection{\label{Q2.13}å¾®è½¯Windowsä¸‹è£…æœ‰MikTeXï¼Œä¸ºä»€ä¹ˆå½“è¯•å›¾ç”»ä¸€ä¸ªlabelæ—¶Asymptoteæ²¡ååº”äº†ï¼Ÿ}
è¿™æœ‰å¯èƒ½æ„å‘³ç€latexå’Œdvipsä¸åœ¨ä½&nbsp;çš„é»˜è®¤è·¯å¾„ä¸­ï¼Œå°è¯•å°†å¦‚ä¸‹è¡ŒåŠ&nbsp;å…¥åˆ°ä½&nbsp;çš„config.asyæ–‡ä»¶ä¸­ï¼š

\begin{verbatim}
import settings;
latex="C:\texmf\miktex\bin\latex.exe";
dvips="C:\texmf\miktex\bin\dvips.exe";
\end{verbatim}

\section{\label{Q3}å…³äºŽè·¯å¾„ï¼ˆpathï¼‰çš„é—®é¢˜}
\subsection{\label{Q3.1}å½“æˆ‘ä¸ºpath tesnsion æŒ‡å®šä¸€ä¸ªæ•´æ•°å€¼æ—¶ï¼Œä¸ºä»€ä¹ˆä¼šå‡ºçŽ°è¯­æ³•é”™è¯¯ï¼Ÿ}
è¿™é‡Œå‘ç”Ÿçš„æ˜¯ï¼Œå¦‚ä¸‹ä¸€å¥
\begin{lstlisting}
draw((0,0)..tension 2..(0,50)..(100,100));
\end{lstlisting}
è¢«ç†è§£ä¸º
\begin{lstlisting}
draw((0,0)..tension 2. .(0,50)..(100,100));
\end{lstlisting}
å›&nbsp;æ­¤2åŽé¢çš„ç¬¬ä¸€ä¸ª~.~è¢«å½“æˆäº†å°æ•°ç‚¹ã€‚æ•´æ•°çš„tensionå€¼ä¹‹åŽåŠ&nbsp;ä¸ªç©ºæ&nbsp;¼å°±å¥½äº†ã€‚ 
\begin{lstlisting}
draw((0,0)..tension 2 ..(0,50)..(100,100));
\end{lstlisting}

\subsection{\label{Q3.2}ç‚¹ä¸åº”è¯¥ä¿æŒä¸€æ&nbsp;·å¤§å°å—ï¼Ÿ}
æ–‡æ¡£ä¸­æåˆ°ï¼š\\
â€œplainæ¨¡å—ä¸­å®šä¹‰çš„dotå‘½ä»¤ç”»çš„ç‚¹å…·æœ‰ç”±penå‚æ•°æ˜Žç¡®æŒ‡å®šçš„çº¿å®½æˆ–è€…æ˜¯é»˜è®¤çº¿å®½ä¹˜ä»¥ä¸€ä¸ª
ç¼©æ”¾å›&nbsp;å­dotfactorï¼ˆé»˜è®¤å€¼ä¸º6ï¼‰ã€‚â€\\
å›&nbsp;æ­¤ï¼Œå½“ä½&nbsp;ä½¿ç”¨é»˜è®¤ç”»ç¬”ï¼ˆpenï¼‰æ—¶ï¼Œç‚¹çš„å°ºå¯¸ä¸º 6*linewidthï¼Œä½†æ˜¯å½“ä½&nbsp;æŒ‡å®šå…·æœ‰æ˜Žç¡®çº¿å®½çš„ç”»ç¬”æ—¶ï¼Œ
ä½&nbsp;å¾—åˆ°çš„ç‚¹çš„å¤§å°å°±æ˜¯ä½&nbsp;æŒ‡å®šçº¿å®½ã€‚å¦‚æžœä½&nbsp;å¸Œæœ›ç¬¬ä¸€ç§æƒ…å†µå’Œç¬¬äºŒç§æƒ…å†µçš„è¡Œä¸ºä¸€æ&nbsp;·ï¼Œå¯ä»¥è®¾ç½® dotfactor=1ã€‚

\section{\label{Q4}å…³äºŽæ&nbsp;‡æ³¨ï¼ˆlabelsï¼‰çš„é—®é¢˜}
\subsection{\label{Q4.1}å¦‚ä½•åœ¨æ&nbsp;‡æ³¨ä¸­ä½¿ç”¨å¸Œè…Šå­—æ¯ï¼Œæ¯”å¦‚~$\omega$}
åœ¨(La)TeXä¸­ï¼Œå¸Œè…Šå­—æ¯å¯ä»¥åœ¨æ•°å­¦æ¨¡å¼ä¸­å®žçŽ°ï¼Œé€šè¿‡åœ¨å…¶è‹±æ–‡åç§°å‰åŠ&nbsp;ä¸€ä¸ªåæ–œæ&nbsp;å¾—åˆ°ã€‚
å›&nbsp;æ­¤ï¼Œ$\omega$~ç¬¦å·ä½¿ç”¨~\verb|"$\omega$"|~å¾—åˆ°ã€‚ä¸¤ä¸ªç¾Žå…ƒç¬¦å·ä¹‹é—´çš„ä»»ä½•ä¸œè¥¿éƒ½è¢«å½“åš
å…¬å¼çœ‹å¾…ã€‚å¤§å†™å¸Œè…Šå­—æ¯é€šè¿‡æŠŠå…¶åç§°é¦–å­—æ¯å¤§å†™å¾—åˆ°ï¼š\\
\myfig{4-1}
\begin{lstlisting}
label("$\omega$",(0,0));
label("$\Omega$",(20,0));
\end{lstlisting}

\subsection{\label{Q4.2}Asymptoteå¯ä»¥ä½¿ç”¨çŸ©é˜µä½œä¸ºæ&nbsp;‡æ³¨å—ï¼Ÿ}
å½“ç„¶å¯ä»¥ï¼
\myfig{4-2}
\begin{lstlisting}
usepackage("amsmath");
label("$\begin{matrix} 1 &amp; 2 \\\ 1 &amp; 1 \end{matrix}$",(0,0));
\end{lstlisting}

\subsection{\label{Q4.3}æˆ‘å¦‚ä½•è®©AsymptoteåŠ&nbsp;è½½æŒ‡å®šLaTeXå®åŒ…ï¼Œæ¯”å¦‚mathptmxï¼Ÿ}
æŠŠå¦‚ä¸‹ä¸€å¥åŠ&nbsp;åˆ°ä½&nbsp;çš„æ–‡ä»¶å¼€å¤´å³å¯ï¼š
\begin{lstlisting}
usepackage("mathptmx");
\end{lstlisting}
æ³¨æ„ï¼šå¦‚æžœæƒ³å¯¹æ–‡æœ¬ä½¿ç”¨Adobe Times Romanå­—ä½“çš„è¯ï¼Œä½&nbsp;è¿˜åº”è¯¥åŠ&nbsp;ä¸Šï¼š
\begin{lstlisting}
defaultpen(TimesRoman());
\end{lstlisting}

\subsection{\label{Q4.4}Asymptoteçš„æ&nbsp;‡æ³¨ä¸­å¦‚ä½•ä½¿ç”¨å›½é™…å­—ä½“ï¼Ÿ}
è¯·å‚è€ƒ~\url{http://asymptote.sourceforge.net/doc/unicode.html}ã€‚

\subsection{\label{Q4.5}æˆ‘å¦‚ä½•ä½¿ç”¨Fourierå­—ä½“ï¼Ÿ}

\begin{lstlisting}
usepackage("fourier");
defaultpen(font("T1","fut\textfamilyextension","m","n"));
\end{lstlisting}

\subsection{\label{Q4.6}æœ‰æ²¡æœ‰åŠžæ³•æ”¹å˜å°æ•°ç‚¹çš„çš„å¤–è§‚ï¼Œæ¯”å¦‚ä¸ç”¨ç‚¹è€Œç”¨é€—å·ï¼Ÿ}
åªéœ€æ­£ç¡®è®¾å®šç³»ç»Ÿçš„locale\footnote{è¯‘è€…æ³¨ï¼šlocaleæ˜¯Linux/UNIXç³»ç»Ÿä¸‹çš„æœ¯è¯­ï¼Œç”¨äºŽ
è¯­è¨€ã€æ—¥æœŸã€è´§å¸ç­‰çš„æœ¬åœŸåŒ–è®¾ç½®ã€‚}ã€‚è¿™æ˜¯ä¸¤ä¸ªä¾‹å­ï¼ˆåœ¨UNIXçš„bash shellä¸‹ï¼‰ï¼š
\begin{verbatim}
echo "label(format(0.5));" | LC_NUMERIC=it_IT asy -V -

LC_NUMERIC=it_IT asy -V lineargraph 
\end{verbatim}

\subsection{\label{Q4.7}æˆ‘è¦å¦‚ä½•æ‰èƒ½å°†æ&nbsp;‡æ³¨æ—‹è½¬ï¼ŒåŒæ—¶è®©å®ƒçš„å·²å¡«å……è¾¹æ¡†ä¿æŒåŒæ­¥æ—‹è½¬å‘¢ï¼Ÿ}
\myfig{4-7}
\begin{lstlisting}
frame f;
label(f,"This is some text",white,Fill(blue));
add(rotate(65)*f);
\end{lstlisting}

\subsection{\label{Q4.8}æˆ‘å¦‚ä½•æ—‹è½¬ä¸‰ç»´å›¾ä¸­çš„æ&nbsp;‡æ³¨ï¼Ÿ}
ä½&nbsp;éœ€è¦é¦–å…ˆå°†tripleç±»åž‹æŠ•å½±ä¸ºpairç±»åž‹ï¼Œåƒè¿™æ&nbsp;·ï¼š

\myfig{4-8}
\begin{lstlisting}
import three;
size(100,100);

draw(rotate(90,project(Z))*"A",O--X);
\end{lstlisting}

\subsection{\label{Q4.9}æˆ‘å¦‚ä½•ç”»ä¸€äº›å›ºå®šå°ºå¯¸çš„æ­£æ–¹å½¢å’Œåœ†å¹¶æŠŠæ&nbsp;‡æ³¨æ”¾åœ¨å®ƒä»¬çš„ä¸­å¿ƒï¼Ÿ}

å›ºå®šå°ºå¯¸çš„å¯¹è±¡åº”è¯¥ç”»åœ¨ç‹¬ç«‹çš„pictureä¸Šï¼Œç„¶åŽå†æŠŠå®ƒä»¬æ·»åŠ&nbsp;åˆ°currentpictureä¸Šã€‚
è¿™æ˜¯ä¸€ç§æ–¹æ³•ï¼ˆä¹Ÿå¯å‚è€ƒ~\url{ http://asymptote.sourceforge.net/gallery/subpictures.asy}
å’Œ~\url{http://asymptote.sourceforge.net/gallery/mosquito.asy}ï¼‰ï¼š

\myfig{4-9}
\begin{lstlisting}
real u=2cm;
 
picture square;
draw(square,scale(u)*shift(-0.5,-0.5)*unitsquare);
 
picture circle;
draw(circle,scale(0.5u)*unitcircle);
 
void add(picture pic=currentpicture, Label L, picture object, pair z) { 
add(pic,object,z);
label(pic,L,z);
} 
 
add("square",square,(0,0));
add("circle",circle,(5cm,0));
\end{lstlisting}

\subsection{\label{Q4.10}äºŒå…ƒç®—ç¬¦ * å¯ä»¥ç”¨ä¸€ä¸ªå›&nbsp;å­æ¥ç¼©æ”¾ç”»ç¬”çš„é¢œè‰²ï¼Œè¿™ä¸ªç¼©æ”¾å›&nbsp;å­å¿…é¡»å°äºŽ1å—ï¼Ÿ}

ç¼©æ”¾å›&nbsp;å­å¯ä»¥å¤§äºŽ1ï¼Œä½†æ˜¯æ‚¨å›&nbsp;è¯¥è®°ä½rgbé¢œè‰²åˆ†é‡åˆ°1å°±é¥±å’Œäº†ã€‚\\
å°è¯•å¦‚ä¸‹ä»£ç&nbsp;ä½&nbsp;å°±å¾ˆå¿«æ˜Žç™½æ˜¯æ€Žä¹ˆå›žäº‹äº†ï¼š
\begin{lstlisting}
write(cyan); write(0.8*cyan); write(1.5*cyan);
\end{lstlisting}
è¦å¾—åˆ°æµ…ä¸€äº›çš„ \verb|cyan| é¢œè‰²ä½&nbsp;å¯ä»¥ç”¨ \verb|white+cyan|ï¼Œè¿™å°†äº§ç”Ÿ \verb|rgb(0.5,1,1)|ã€‚
å¦‚æžœä½&nbsp;æƒ³è®©æŸç§é¢œè‰²æ›´æµ…çš„è¯ï¼Œå°±ç›´æŽ¥æŒ‡å®šrgbé¢œè‰²å§ï¼Œä¾‹å¦‚ \verb|rgb(0.9,1,1)|ã€‚

ä»¤å¤–ï¼Œåœ¨cmyké¢œè‰²ç©ºé—´é‡Œï¼Œé¥±å’Œåº¦æ˜¯ä¸Žè‰²è°ƒåˆ†å¼€æ¥ç‹¬ç«‹å¤„ç†çš„ï¼Œè¿™æ&nbsp;·æ›´æ–¹ä¾¿ï¼š
\verb|0.1*Cyan| æµ…ï¼Œ \verb|0.9*Cyan| æ·±ã€‚ä½&nbsp;ä¹Ÿå¯ä»¥è¿™ä¹ˆå†™~\verb|0.1*(red+cmyk)|ã€‚


\subsection{\label{Q4.11}ä¸ºä»€ä¹ˆåœ¨æˆ‘çš„localeä¸‹ï¼Œé€—å·å°æ•°ç‚¹åŽçš„ç©ºç™½é‚£ä¹ˆå¤§ï¼Ÿ}

LaTeXæŠŠé€—å·å½“æˆæ&nbsp;‡ç‚¹è€Œä¸æ˜¯å½“æˆå°æ•°ç‚¹ã€‚è§£å†³åŠžæ³•å°±æ˜¯åœ¨æ–‡ä»¶å¼€å¤´åŠ&nbsp;è½½ icomma åŒ…ï¼š
\begin{lstlisting}
usepackage("icomma");
\end{lstlisting}

\subsection{\label{Q4.12}å¦‚ä½•é˜»æ­¢ texpreamble("$\backslash$usepackage[pdflatex]\{hyperref\}") æ”¹å˜é¡µé¢å°ºå¯¸ï¼Ÿ}

\begin{lstlisting}
texpreamble("\\usepackage[pdftex,setpagesize=false]{hyperref}");
\end{lstlisting}

\section{\label{Q5}å…³äºŽç®­å¤´çš„é—®é¢˜}
\subsection{\label{Q5.1}æˆ‘å¦‚ä½•åœ¨ä¸€æ¡è·¯å¾„ä¸Šçš„ä»»ä½•ä½ç½®å¤„ç”»ä¸¤ä¸ªç®­å¤´ï¼Ÿ}
å‡è®¾è‡³å°‘ä¸€ä¸ªç®­å¤´è¢«å¡«å……ï¼Œä½&nbsp;å¯ä»¥è¿™æ&nbsp;·åšï¼š

\myfig{5-1a}
\begin{lstlisting}
size(200); 
path g = (0,0)..(1,3)..(3,0); 
draw(g,Arrow(Relative(0.9))); 
add(arrow(g,invisible,FillDraw(black),Relative(0.5))); 
add(arrow(reverse(g),invisible,FillDraw(white,black),Relative(0.9))); 
\end{lstlisting}

å¦‚æžœä¸¤ä¸ªç®­å¤´éƒ½ä½¿ç”¨å¡«å……ç±»åž‹ \verb|NoFill|ï¼Œä½&nbsp;å°±éœ€è¦åœ¨ plain\_arrows.asyä¸­å»ºä¸€ä¸ªç‰¹å®šç‰ˆæœ¬çš„
~\verb|arrow| ç¨‹åºäº†ï¼š

\begin{lstlisting}
void arrow(frame f, arrowhead arrowhead=DefaultHead,
           path g, pen p=currentpen, real size=0,
           real angle=arrowangle, filltype filltype=arrowhead.defaultfilltype,
           position position=EndPoint, bool forwards=true,
           margin margin=NoMargin, bool center=false);
\end{lstlisting}

\subsection{\label{Q5.2}æˆ‘å¦‚ä½•åè½¬ä¸€ä¸ªç®­å¤´å¤´\protect\footnote{è¯‘è€…æ³¨ï¼šå‘µå‘µï¼Œæ²¡å†™é”™ï¼ŒæŒ‡ç®­å¤´çš„å¤´éƒ¨ï¼Œå³ arrowheadã€‚}çš„æ–¹å‘ï¼Ÿ}
åªéœ€ç®€å•çš„å°†è·¯å¾„çš„æ–¹å‘åè½¬å³å¯ã€‚
\myfig{5-2}
\begin{lstlisting}
path g=((0,0)--(5cm,0));
draw(reverse(g),Arrow(Relative(0.55)));
\end{lstlisting}

\subsection{\label{Q5.3}æˆ‘å¦‚ä½•æ”¹å˜æ‰€æœ‰ç®­å¤´çš„å¤§å°ï¼Ÿ}
è¦æŒ‡å®šç®­å¤´å°ºå¯¸ï¼Œä½&nbsp;å¯ä»¥ç»™æ¯ä¸ªç”»å›¾å±žæ€§ \verb|Arrow| æŒ‡å®šä¸€ä¸ªå®žåž‹å°ºå¯¸å‚æ•°ã€‚
å¦‚æžœæƒ³å…¨å±€çš„æ”¹å˜ï¼Œå¯ä»¥å¦‚ä¸‹é‡è½½ä¾èµ–ç”»ç¬”çš„ \verb|arrowsize| å‡½æ•°ï¼š

\begin{lstlisting}
arrowsize=new real(pen p=currentpen) {return 2mm;};
\end{lstlisting}

\subsection{\label{Q5.4}æˆ‘èƒ½åˆ›å»ºå…¶å®ƒçš„ç®­å¤´å¤´ç±»åž‹å—ï¼Ÿ}
ä½&nbsp;å¯ä»¥è¿™æ&nbsp;·åˆ›å»ºè‡ªå®šä¹‰çš„ç®­å¤´å¤´ï¼ˆè¿›ä¸€æ­¥çš„ä¾‹å­è¯·å‚çœ‹plain\_arrows.asyä¸­é¢„å®šä¹‰çš„ç®­å¤´å¤´ç±»åž‹ï¼‰ï¼š

\myfig{5-4}
\begin{lstlisting}
arrowhead DotHead;
DotHead.head=new path(path g, position position=EndPoint, pen p=currentpen,
		      real size=0, real angle=0)
{
  if(size == 0) size=DotHead.size(p);
  bool relative=position.relative;
  real position=position.position.x;
  if(relative) position=reltime(g,position);
  path r=subpath(g,position,0.0);
  pair x=point(r,0);
  real t=arctime(r,size);
  pair y=point(r,t);
  return circle(0.5(x+y),0.5size);
};

size(100);
draw((0,0)..(1,1)..(2,0),Arrow(DotHead));
dot((2,0),red);
\end{lstlisting}
å¦‚æžœä½&nbsp;å°†è‡ªå®šä¹‰çš„ç®­å¤´å¤´ç±»åž‹æäº¤åˆ°è®ºå›æˆ–è¡¥ä¸è·Ÿè¸ªç³»ç»Ÿä¸­ï¼Œæˆ‘ä»¬ä¼šè€ƒè™‘
æŠŠå®ƒä»¬åŒ…æ‹¬åœ¨ä»¥åŽçš„ç‰ˆæœ¬ä¸­ã€‚




\section{\label{Q6}äºŒç»´åæ&nbsp;‡å›¾çš„é—®é¢˜}
\subsection{\label{Q6.1}æ²¿ç€$x$è½´çš„æ­£å‘ï¼Œå¦‚ä½•èƒ½è®©åˆ»åº¦ï¼ˆticksï¼‰æ&nbsp;‡åœ¨$x$è½´çš„å³ä¾§è€Œåˆ»åº¦çš„æ&nbsp;‡æ³¨æ&nbsp;‡åœ¨å·¦ä¾§
\protect\footnote{è¯‘è€…æ³¨ï¼šè¿™é‡Œçš„å·¦å³å¾—è¿™æ&nbsp;·ç†è§£ï¼Œå³è§‚å¯Ÿè€…çš„èº«ä½“è¦ä¸Ž$x$è½´å¹³è¡Œ}ï¼Ÿ}
\myfig{6-1}
\begin{lstlisting}
import graph;

size(250,200,IgnoreAspect);

draw(graph(exp,-1,1),red);

xaxis("$x$",RightTicks(Label(align=left)));
yaxis("$y$",RightTicks);
\end{lstlisting}

\subsection{\label{Q6.2}å¦‚ä½•é‡å®šä½$x$è½´æ&nbsp;‡æ³¨åˆ°æ²¿è½´é•¿åº¦3/4å¤„ï¼Ÿ}

\myfig{6-2}
\begin{lstlisting}
import graph;

size(250,200,IgnoreAspect);

draw(graph(exp,-1,1),red);

xaxis(Label("$x$",0.75),LeftTicks);
yaxis("$y$",RightTicks);
\end{lstlisting}

\subsection{\label{Q6.3}å¦‚ä½•å‘ä¸‹ç§»åŠ¨$x$è½´æ&nbsp;‡æ³¨10bpï¼Ÿ}

\myfig{6-3}
\begin{lstlisting}
import graph;
size(250,200,IgnoreAspect);

draw(graph(exp,-1,1),red);

xaxis(shift(0,-10)*"$x$",LeftTicks);
yaxis("$y$",RightTicks);
\end{lstlisting}

\subsection{\label{Q6.4}æˆ‘èƒ½å¯¹åæ&nbsp;‡è½´ã€è½´æ&nbsp;‡æ³¨å’Œåˆ»åº¦æ&nbsp;‡æ³¨ç”¨ä¸åŒçš„ç”»ç¬”å—ï¼Ÿ}

å½“ç„¶å¯ä»¥:
\myfig{6-4}
\begin{lstlisting}
import graph;
size(300,200,IgnoreAspect);

xlimits(-50,50);
ylimits(0,100);

xaxis(Label("$x$",MidPoint,red),Bottom,blue,LeftTicks(green));
yaxis("$y$",Left,RightTicks);
\end{lstlisting}

\subsection{\label{Q6.5}å¦‚ä½•æ›´æ”¹è½´æ&nbsp;‡æ³¨çš„å­—ä½“ï¼Ÿ}

\myfig{6-5}
\begin{lstlisting}
import graph;
size(300,200,IgnoreAspect);

xlimits(-50,50);
ylimits(0,100);

xaxis("x",Bottom,Courier("m","n"),LeftTicks);
yaxis("$y$",Left,RightTicks);
\end{lstlisting}

\subsection{\label{Q6.6}å¦‚ä½•æ”¹å˜åæ&nbsp;‡è½´ä¸Šçš„åˆ»åº¦æ&nbsp;‡æ³¨çš„å­—ä½“ç±»åž‹ï¼Ÿ}
åˆ»åº¦æ&nbsp;‡æ³¨é»˜è®¤åœ¨TeXçš„æ•°å­¦æ¨¡å¼ä¸­æŽ’ç‰ˆï¼Œå›&nbsp;æ­¤è¦ä½¿ç”¨å…¶å®ƒå­—ä½“ï¼Œä½&nbsp;éœ€è¦é‡è½½é»˜è®¤çš„åˆ»åº¦æ&nbsp;¼å¼ï¼š

\myfig{6-6}
\begin{lstlisting}
import graph;
size(300,200,IgnoreAspect);

xlimits(-50,50);
ylimits(0,100);

xaxis("$x$",Bottom,LeftTicks("%.4g",Courier("m","n")+fontsize(12)));
yaxis("$y$",Left,RightTicks);
\end{lstlisting}


\subsection{\label{Q6.7}å¦‚ä½•é˜»æ­¢è½´æ&nbsp;‡æ³¨é‡å&nbsp;åœ¨å½¼æ­¤ä¹‹ä¸Šï¼Ÿ}
%Question 6.7.  How can I prevent axes tick labels from rendering on top of each other?

ä½&nbsp;å¯ä»¥ï¼š

(1) ä¸º \verb|LeftTicks/RightTicks/Ticsk| æŒ‡å®šå‚æ•° \verb|beginlabel=false| å’Œ$/$æˆ– \verb|endlabel=false|ï¼›

(2) æ‰‹åŠ¨åŽ»æŽ‰æŒ‡å®šåˆ»åº¦åŠå…¶æ&nbsp;‡æ³¨ï¼ˆæ‰‹åŠ¨åŽ»ç”»ï¼›å…³äºŽ \verb|NoZero| çš„å®šä¹‰è¯·å‚çœ‹
\url{http://asymptote.svn.sourceforge.net/viewvc/asymptote/trunk/asymptote/base/graph.asy}ï¼‰ï¼š

\myfig{6-7b}
\begin{lstlisting}
import graph;

size(10cm);

real f(real x) {return x^2;}
 
draw(graph(f,-2,2));

xaxis(Ticks(NoZero));
yaxis(Ticks(NoZero));

label("$0$",(0,0),SW);
\end{lstlisting}
(3) åŽ»æŽ‰æŒ‡å®šåˆ»åº¦æ&nbsp;‡æ³¨å¹¶æ‰‹åŠ¨ç”»ï¼ˆå…³äºŽ~\verb|NoZeroFormat|~çš„å®šä¹‰è¯·å‚è€ƒ
\url{http://asymptote.svn.sourceforge.net/viewvc/asymptote/trunk/asymptote/base/graph.asy}
\myfig{6-7c}
\begin{lstlisting}
import graph;

size(10cm);

real f(real x) {return x^2;}
 
draw(graph(f,-2,2));

xaxis(Ticks(NoZeroFormat));
yaxis(Ticks(NoZeroFormat));

label("$0$",(0,0),SW);
\end{lstlisting}

(4) ä½¿ç”¨å›¾å½¢ç•Œé¢ xasy æ¥ç§»åŠ¨é‡å&nbsp;çš„æ&nbsp;‡æ³¨ã€‚


(5) æ”¹å˜~\verb|Label|~çš„å‚æ•°~\verb|LeftTicsk|ï¼Œ\verb|RgihtTicks|ï¼Œ\verb|Ticks|~ä¸ºï¼š

\begin{lstlisting}
Label(currentpen+overwrite(Move))
\end{lstlisting}

åŠžæ³•(5)ä¼šç§»åŠ¨å¯èƒ½å’Œå‰é¢ç”»çš„æ&nbsp;‡æ³¨çš„é‡å&nbsp;çš„æ&nbsp;‡æ³¨ã€‚\verb|overwrite|~çš„å…¶å®ƒå¯ç”¨çš„å‚æ•°
ä¸º~\verb|Allow|ï¼ˆå…è®¸æ&nbsp;‡æ³¨é‡å&nbsp;ï¼Œé»˜è®¤è®¾ç½®ï¼‰ï¼Œ\verb|Suppress|ï¼ˆé‡å&nbsp;çš„æ&nbsp;‡æ³¨æ&nbsp;¹æœ¬ä¸ç”»å‡ºï¼‰ï¼Œ
\verb|SuppressQuiet|~å’Œ\verb|MoveQuiet|ã€‚æœ€åŽä¸¤ä¸ªäº§ç”Ÿå’Œç›¸åº”æ²¡æœ‰~\verb|Quiet|~çš„
å‚æ•°åŒæ&nbsp;·çš„ç»“æžœï¼Œåªæ˜¯ä¸å†æç¤ºå“ªäº›æ&nbsp;‡æ³¨é‡å&nbsp;äº†ã€‚è¯·çœ‹
\url{See:  http://asymptote.sourceforge.net/doc/Pens.html}ã€‚

è‹¥æ˜¯ç”¨æˆ·æŒ‡å®š~\verb|tick|~æ•°ç»„çš„æƒ…å†µä¸‹ï¼Œå¯ä»¥é€šè¿‡æ”¹å˜æ•°ç»„å…ƒç´&nbsp;é¡ºåºæ¥æ”¹å˜å“ªäº›æ&nbsp;‡æ³¨
è¢«ç¦æ­¢ï¼ˆsuppressedï¼‰æˆ–ç§»åŠ¨ã€‚

\subsection{\label{Q6.8}å¦‚ä½•åœ¨ä¸è€ƒè™‘æ&nbsp;‡æ³¨å’Œå›¾ä¾‹çš„æƒ…å†µä¸‹ä½¿å¾—æ‰€ç”»å›¾çš„åŒºåŸŸå…·æœ‰å›ºå®šå¤§å°ï¼Ÿ}
ä½&nbsp;å¯ä»¥ï¼š

(1) æŒ‡å®šä¸€ä¸ªæ˜Žç¡®çš„å•ä½ï¼ˆ\verb|unitsize|ï¼‰ï¼Œè¿™å°†å¯¹ä»»ä½•å¯¹å°ºå¯¸çš„è°ƒç”¨æœ‰æ•ˆï¼š
\begin{lstlisting}
unitsize(x=1cm,y=2cm);
\end{lstlisting}

(2) æ˜Žç¡®å‘Šè¯‰Asymptoteï¼Œè®©å®ƒæŠŠç”»å›¾åŒºåŸŸæ˜&nbsp;å°„åˆ°æŒ‡å®šå¤§å°ï¼š
\myfig{6-8b}
\begin{lstlisting}
import graph;
real[] x={0,1,2,3};
real[] y=x^2;
draw(graph(x,y),red);
xaxis("$x$",BottomTop,LeftTicks);
yaxis("$y$",LeftRight,RightTicks);

size(5cm,5cm,point(SW),point(NE));

label("$f_\mathrm{T}$",point(N),2N);
\end{lstlisting}

(3) ä»¥ç”¨æˆ·åæ&nbsp;‡æŒ‡å®šç‚¹çš„ä½ç½®ï¼Œç›¸å½“äºŽç»™å®šå›¾åƒå¤§å°ï¼š
\myfig{6-8c}
\begin{lstlisting}
given picture size:

import graph;

size(250,200,IgnoreAspect);

draw(graph(exp,-1,1),red);

xaxis("$x$",BottomTop,LeftTicks);
yaxis("$y$",LeftRight,RightTicks);

fixedscaling((-1.5,-0.5),(1.5,3.5));
\end{lstlisting}

åœ¨è¿™ä¸ªä¾‹å­ä¸­ï¼Œç”¨æˆ·åæ&nbsp;‡(-1.5,-0.5)ä½äºŽå›¾çš„å·¦ä¸‹è§’ï¼Œ(1.5,3.5)ä¸ºå³ä¸Šè§’ã€‚
å¯ä»¥ä½¿ç”¨è¿™ä¸ªé€‰é¡¹æ¥ç¡®ä¿å¤šä¸ªå›¾å…·æœ‰ç›¸åŒçš„ç¼©æ”¾ä»¥åŠç›¸åŒçš„æœ€ç»ˆå°ºå¯¸ï¼ˆåªéœ€
ä¿è¯ä¼&nbsp;ç»™ \verb|fixedscaling()| çš„ä¸¤ä¸ªåæ&nbsp;‡ç»™æ‰€æœ‰æ&nbsp;‡æ³¨ç•™æœ‰è¶³å¤Ÿçš„ç©ºé—´å³å¯ï¼‰ã€‚

è¿˜å¯å‚è€ƒ \url{http://asymptote.sourceforge.net/doc/Frames-and-pictures.html}ã€‚

\subsection{\label{Q6.9}å¦‚ä½•åœ¨ $[0,1]\times[0,2]$ èŒƒå›´å†…ç”»ä¸€ä¸ªå‡½æ•° $f(x)$ï¼Œè€Œä¸”è¿˜ä¸ç”¨åŽ»ç®¡ $f(x)$ æ˜¯å¦ä¼šè¾¾åˆ°å›¾çš„è¾¹ç•Œï¼Ÿ}
åœ¨ç”»å›¾å‰è°ƒç”¨ä¸€ä¸‹å¸¦æœ‰ \verb|Crop| é€‰é¡¹ \verb|limits| å‡½æ•°å³å¯ï¼š
\myfig{6-9}
\begin{lstlisting}
import graph;

size(250,200,IgnoreAspect);

draw(graph(exp,-1,1),red);

limits((0,0),(1,2),Crop);

xaxis("$x$",BottomTop,LeftTicks);
yaxis("$y$",LeftRight,RightTicks);
\end{lstlisting}

è¿˜å¯å‚è€ƒ \url{http://asymptote.sourceforge.net/doc/graph.html}ã€‚


\subsection{\label{Q6.10}å¯ä»¥è‡ªå®šä¹‰è°ƒè‰²æ¿å—ï¼Ÿ}
æ˜¯çš„ï¼Œä½&nbsp;å¯ä»¥äº§ç”Ÿä½&nbsp;è‡ªå·±çš„ \verb|pen[]| æ•°ç»„ã€‚ä¾‹å¦‚ï¼š

\begin{lstlisting}
int NColors=32768;
pen[] MyPalette=new pen[NColors];
real step=1/(NColors-1.0);
// Start at black: rgb(0,0,0) 
// End at yellow: rgb(1,1,0) 
for(int i=0; i &lt; NColors; ++i) { 
  real rgval=i*step;
  MyPalette[i]=rgb(rgval,rgval,0.0);
} 
\end{lstlisting}

\subsection{\label{Q6.11}æœ‰æ²¡æœ‰ç®€å•çš„æ–¹æ³•å¯ä»¥ç”»å‡ºæ¼‚äº®çš„é˜¶ä¹˜å‡½æ•°å›¾ï¼Ÿ}
ä»¥ä¸‹ä¾‹å­ç»™å‡ºçš„æ˜¯è¿žç»­å‡½æ•°ï¼Œå¹¶ç”¨ä¸¤ç§ä¸åŒæ–¹æ³•æ&nbsp;‡å‡ºäº† $x$ çš„æ•´æ•°å€¼ï¼š\\
ï¼ˆè¯‘è€…æ³¨ï¼šä¸‹é¢ä¾‹å­ä¸­çš„ä¸Šå›¾å¯¹åº”æ–¹æ³•ä¸€ï¼Œä¸‹å›¾å¯¹åº”æ–¹æ³•äºŒã€‚ï¼‰
\myfig{6-11a}
\myfig{6-11b}
\begin{lstlisting}
import graph;
 
size(200,200,IgnoreAspect);
 
real factorial(real t) {return gamma(t+1);} 
 
scale(Linear,Log);
 
// ç”»é˜¶ä¹˜å‡½æ•°å›¾ã€‚
draw(graph(factorial,0,10));
 
// æ–¹æ³• 1: åªç”»ç»“ç‚¹ï¼ŒæŠŠçº¿éšè—
pair F(int t) {return (t,factorial(t));} 
// ä»Ž 0 åˆ° 10 çš„é˜¶ä¹˜å›¾
pair[] z=sequence(F,11);
// è¯‘è€…æ³¨ï¼šä¸‹é¢çš„ above=true å‚æ•°å¤„åœ¨åŽŸ FAQ ä¸­ç»™çš„æ˜¯ Below ï¼Œä½†ç¼–è¯‘ä¸é€šè¿‡ã€‚
draw(graph(z),invisible,marker(scale(0.8mm)*unitcircle,blue,Fill,above=true));
 
// æ–¹æ³• 2: éžä½œå›¾ç¨‹åºè¦æŒ‡å®šæ˜Žç¡®çš„ç¼©æ”¾ (scaling):
pair dotloc(int t) {return Scale(F(t));} 
pair[] dotlocs=sequence(dotloc,11);
dot(dotlocs);
 
xaxis("$x$",BottomTop,LeftTicks);
yaxis("$y$",LeftRight,RightTicks);
\end{lstlisting}

\subsection{\label{Q6.12}åœ¨ä¸€ä¸ªæœ‰è‡ªå·±å°ºå¯¸çš„å›¾ï¼ˆpictureï¼‰ä¸­ï¼Œå¦‚ä½•å•ç‹¬æŒ‡å®šæŸä¸ªç‰¹å®šé•¿åº¦è€Œä¸è¢«ç¼©æ”¾ï¼Ÿ}
è¿™é‡Œæœ‰ä¸€ä¸ªç®€å•çš„æ–¹æ³•æ¥å®žçŽ°\footnote{è¯‘è€…æ³¨ï¼šæ³¨æ„ç®­å¤´åŠä¸¤ç«¯çš„å°çº¿æ®µçš„å°ºå¯¸ä¸éšsizeè€Œæ”¹å˜ã€‚}ï¼š

\myfig{6-12}
\begin{lstlisting}
size(12cm,0);
 
void distance(picture pic=currentpicture, pair A, pair B, Label L="", real n=0,
	      pen p=currentpen) 
{
  real d=3mm;
  path g=A--B;
  transform T=shift(-n*d*unit(B-A)*I);
  pic.add(new void(frame f, transform t) {
    picture opic;
    path G=T*t*g;
    draw(opic,Label(L,Center,UnFill(1)),G,p,Arrows(NoFill),Bars,PenMargins);
    add(f,opic.fit());
  });
  pic.addBox(min(g),max(g),T*min(p),T*max(p));
} 
 
pair A=(0,0), B=(3,3);
 
dot(A);
dot(B);
 
distance(A,B,"$\ell$",1);
\end{lstlisting}

\subsection{\label{Q6.13}å¦‚ä½•ä½¿ $y$ æ˜¾ç¤ºä»¥2ä¸ºåº•çš„å¯¹æ•°å€¼ï¼Ÿ}

å‚è€ƒä¾‹å­ \url{http://asymptote.sourceforge.net/gallery/2Dgraphs/log2graph.asy}ã€‚
\subsection{\label{Q6.14}å¦‚ä½•åœ¨åŒä¸€å¼&nbsp;å›¾ä¸­å¯¹é½ä¸¤ä¸ªåæ&nbsp;‡å›¾çš„ $x$ è½´ï¼Ÿ}
å¦‚æžœå°†è¦å¯¹é½çš„ä¸¤ä¸ªè½´å…·æœ‰åŒæ&nbsp;·çš„æ¯”ä¾‹ï¼ˆscaleï¼‰åŠå°ºå¯¸ï¼Œä¾‹å­ä¸­ç»™å‡ºäº†ä¸€ä¸ªç®€å•çš„æ–¹æ³•ï¼Œ
è¯·å‚è§ \url{http://asymptote.sourceforge.net/gallery/2D graphs/alignedaxis.asy}ã€‚

ä¸‹é¢ç»™å‡ºçš„æ˜¯ä¸€ä¸ªå¯¹é½ä»»æ„ä¸¤ä¸ªè½´çš„æ›´ä¸€èˆ¬çš„æ–¹æ³•ã€‚å¯¹ç¬¬äºŒä¸ªpictureè°ƒç”¨ \verb|fit|
ä½¿ä¹‹é€‚åˆåŸºäºŽç¬¬ä¸€ä¸ªpictureçš„æ°´å¹³æ¯”ä¾‹çš„æ¡†æž¶ï¼ˆframeï¼‰:

\myfig{6-14}
\begin{lstlisting}
import graph;

real width=15cm;
real aspect=0.3;

picture pic1,pic2;

size(pic1,width,aspect*width,IgnoreAspect);
size(pic2,width,aspect*width,IgnoreAspect);

scale(pic1,false);
scale(pic2,false);

real xmin1=6;
real xmax1=9;
real xmin2=8;
real xmax2=16;

real a1=1;
real a2=0.001;

real f1(real x) {return a1*sin(x/2*pi);}
real f2(real x) {return a2*sin(x/4*pi);}

draw(pic1,graph(pic1,f1,xmin1,xmax1));
draw(pic2,graph(pic2,f2,xmin2,xmax2));

xaxis(pic1,Bottom,LeftTicks());
yaxis(pic1,"$f_1(x)$",Left,RightTicks);

xaxis(pic2,"$x$",Bottom,LeftTicks(Step=4));
yaxis(pic2,"$f_2(x)$",Left,RightTicks);

yequals(pic1,0,Dotted);
yequals(pic2,0,Dotted);

pair min1=point(pic1,SW);
pair max1=point(pic1,NE);

pair min2=point(pic2,SW);
pair max2=point(pic2,NE);

real scale=(max1.x-min1.x)/(max2.x-min2.x);
real shift=min1.x/scale-min2.x;

transform t1=pic1.calculateTransform();
transform t2=pic2.calculateTransform();
transform T=xscale(scale*t1.xx)*yscale(t2.yy);

add(pic1.fit());
//è¯‘è€…æ³¨ï¼šä¸‹é¢ truepoint å¤„åœ¨åŽŸ FAQ ä¸­ä¸º framepoint ï¼Œä½†æ˜¯ç¼–è¯‘ä¸é€šè¿‡ã€‚
real height=truepoint(N).y-truepoint(S).y;
add(shift(0,-height)*(shift(shift)*pic2).fit(T));
\end{lstlisting}

\subsection{\label{Q6.15}å¦‚ä½•æ”¹å˜$y$è½´çš„æ–¹å‘ä½¿å¾—è´Ÿå€¼å‡ºçŽ°åœ¨$y$è½´çš„ä¸Šéƒ¨ï¼Ÿ}
ä»¥ä¸‹æ˜¯ä¸€ä¸ªç®€å•çš„ä¾‹å­ï¼ˆè¿˜å¯å‚è€ƒä¾‹å­ \url{http://asymptote.sourceforge.net/gallery/2D graphs/diatom.asy}
æˆ–æ–‡æ¡£ä¸­å¯¹ \verb|Linear(-1)| çš„è®¨è®ºï¼‰ï¼š

\myfig{6-15}
\begin{lstlisting}
import graph;
size(250,200,IgnoreAspect);

scale(Linear,Linear(-1));

draw(graph(log,0.1,10),red);

xaxis("$x$",LeftTicks);
yaxis("$y$",RightTicks);
\end{lstlisting}

\subsection{\label{Q6.16}å¦‚ä½•ç”¨ä¸€ä¸ªå®šä¹‰äº†ä¸åŒä½ç½®å¤„é¢œè‰²çš„å‡½æ•°å¡«å……ä¸€æ¡è·¯å¾„ï¼Ÿ}
ä¸€èˆ¬å‡½æ•°ç€è‰²ï¼ˆshadingï¼‰ä»…è¢«PDFæ”¯æŒï¼Œè€Œä¸è¢«PostScriptæ”¯æŒï¼Œå›&nbsp;è€Œå¿…é¡»ç­‰åˆ°æˆ‘ä»¬
å¼€å‘å‡ºç›´æŽ¥çš„PDFä»£ç&nbsp;åŽæ‰è¡Œã€‚

ç›®å‰ä¸€ä¸ªè¿‘ä¼¼çš„å¤„ç†æ–¹æ³•å°±æ˜¯åˆ’åˆ†å‡ºä¸€ä¸ªæ¯”è¾ƒç»†çš„ç½‘æ&nbsp;¼å¹¶æ&nbsp;¹æ®ä¸åŒä½ç½®å¤„çš„é¢œè‰²
å®šä¹‰ä¸€ä¸ªæ•°ç»„ \verb|pen[][]| ç„¶åŽå†åˆ©ç”¨ \verb|latticeshade| è°ƒç”¨è¿™ä¸ªæ•°ç»„æ¥ç€è‰²ã€‚


\subsection{\label{Q6.17}æœ‰æ²¡æœ‰åŠžæ³•ç”»ä¸€ä¸ªæ²¡æœ‰æ˜¾å¼ç»™å‡ºçš„å‡½æ•°ï¼Œæ¯”å¦‚ $(y-2)^2=x-1$ ï¼Ÿ}
å¯ä»¥ï¼Œä½¿ç”¨å‚æ•°å½¢å¼ï¼š

\begin{lstlisting}
y=t 
x=(t-2)^2+1 
\end{lstlisting}

å‚è§ä¾‹å­ \url{http://asymptote.sourceforge.net/gallery/2Dgraphs/parametricgraph.asy}ã€‚

\subsection{\label{Q6.18}å¯ä»¥åè½¬æˆ–æ‹‰ä¼¸ä¸€ä¸ªè½´å—ï¼Ÿ}
\verb|Linear| é€šè¿‡ä¸€ä¸ªå®žåž‹çš„ç¼©æ”¾å‚æ•°æ¥æ‹‰ä¼¸ï¼ˆæˆ–åè½¬ï¼‰åæ&nbsp;‡è½´ã€‚è¦çœ‹åˆ°åæ&nbsp;‡è½´æ‹‰ä¼¸çš„æ•ˆæžœï¼Œ
é¡»ç¡®ä¿åœ¨å›¾åƒçš„ \verb|size| å‘½ä»¤ä¸­æ²¡æœ‰æŒ‡å®š \verb|IgnoreAspect|ã€‚

ç¬¬äºŒè½´\footnote{è¯‘è€…æ³¨ï¼šä¸»è½´æŒ‡ä¸‹é¢çš„æ¨ªè½´å’Œå·¦è¾¹çš„çºµè½´ï¼Œç¬¬äºŒè½´æŒ‡ä¸Šé¢çš„æ¨ªè½´å’Œå³è¾¹çš„çºµè½´ã€‚}
å’Œä¸»è½´æœ‰ç€ç›¸åŒçš„é•¿åº¦ï¼Œå›&nbsp;æ­¤æ‹‰ä¼¸æ²¡æœ‰æ•ˆæžœã€‚ä½†æ˜¯ä»ç„¶å¯ä»¥é€šè¿‡ \verb|Linear(-1)| 
æ¥è¿›è¡Œåè½¬ã€‚

\subsection{\label{Q6.19}ä¸ºä»€ä¹ˆæˆ‘ä¸èƒ½ç”¨ UnFill é€‰é¡¹æ¥ç”»ä¸€ä¸ªå…·æœ‰ç©ºå¿ƒæ&nbsp;‡è®°ï¼ˆmarkerï¼‰çš„å›¾ï¼Ÿ}

\verb|UnFill| åœ¨è¿™å„¿ä¸èµ·ä½œç”¨æ˜¯å›&nbsp;ä¸ºå®ƒåªå½±å“é‚£ä¸ªä¸€å¼€å§‹å°±å·²ç»æŠŠæ&nbsp;‡è®°ç”»ä¸ŠåŽ»äº†ä¸”æ˜¯æœªè¢«
æ·»åŠ&nbsp;åˆ° \verb|currentpicture| ä¸Šä¹‹å‰çš„å±€éƒ¨æ¡†æž¶ï¼ˆlocal frameï¼‰ã€‚

\myfig{6-19}
\begin{lstlisting}
import graph;
size(10cm,0);
pair[] z={(0,0),(0.5,0.5),(1,1)};
path g=graph(z);
 
draw(shift(0,.5)*g,marker(scale(5)*unitcircle,FillDraw(white)));
//è¯‘è€…æ³¨ï¼šå¯ä»¥æ¯”è¾ƒä¸€ä¸‹ä»¥ä¸‹å‡&nbsp;å¥çš„æ•ˆæžœã€‚
//draw(shift(0,.5)*g,marker(scale(5)*unitcircle));
//draw(shift(0,.5)*g,marker(scale(5)*unitcircle,Fill));
//draw(shift(0,.5)*g,marker(scale(5)*unitcircle,UnFill));
 
xaxis(BottomTop,LeftTicks);
yaxis(LeftRight,RightTicks);
\end{lstlisting}

\subsection{\label{Q6.20}å¦‚ä½•å¼ºåˆ¶ä»¤å‡&nbsp;ä¸ªå›¾è±¡ä½¿ç”¨åŒä¸€ä¸ªè°ƒè‰²æ¿èŒƒå›´ï¼ˆæ¯”å¦‚æ•´ä¸ª0-255çš„ç°åº¦èŒƒå›´ï¼‰ï¼Ÿ}
è°ƒè‰²æ¿çš„é¢œè‰²ç©ºé—´æ˜¯ä¸€ç³»åˆ—é¢œè‰²çš„èŒƒå›´ï¼Œè¿™ä¸ªèŒƒå›´ä½œä¸ºä¸€ä¸ªå‚æ•°å¯ä»¥è¢«æŒ‡å®šï¼Œæ¯”å¦‚å®ƒå¯ä»¥ä¸º \verb|Full|ï¼Œ
\verb|Automatic| æˆ–ä¸€ä¸ªæ˜¾å¼æŒ‡å®šçš„èŒƒå›´ \verb|Range(pair min, pair max)|ã€‚
è¿™é‡Œï¼Œ\verb|Full| æŒ‡å®šå‡½æ•°åœ¨æŠ½æ&nbsp;·åŒºé—´å†…ä»Žæœ€å°å€¼å˜åˆ°åˆ°æœ€å¤§å€¼çš„èŒƒå›´ï¼Œè€Œ \verb|Automatic| åˆ™ä¼šè‡ªåŠ¨é€‰æ‹©
åˆé€‚çš„ä¸Šä¸‹é™ã€‚

\section{\label{Q7}å…³äºŽç¼–ç¨‹çš„é—®é¢˜}
\subsection{\label{Q7.1}Asymptoteæ˜¯ä¸€ä¸ªè§£é‡Šå™¨è¿˜æ˜¯ä¸€ä¸ªç¼–è¯‘å™¨ï¼Ÿ}
AsymptoteæŠŠå®ƒçš„å‘½ä»¤ç¼–è¯‘æˆè‡ªå·±çš„è™šæ‹Ÿæœºä»£ç&nbsp;ï¼Œç„¶åŽå®ƒå°±åœ¨è™šæ‹Ÿæœºä¸Šè¿è¡Œè¿™ä¸ªè™šæ‹Ÿæœºä»£ç&nbsp;æ¥äº§ç”ŸPostScriptä»£ç&nbsp;ã€‚

\subsection{\label{Q7.2}frameå’Œpictureä¹‹é—´çš„åŒºåˆ«æ˜¯ä»€ä¹ˆï¼Ÿ}
frame æ˜¯ä½¿ç”¨PostScriptåæ&nbsp;‡æ¥ç”»å›¾çš„ç”»å¸ƒã€‚å¯¹ä¸€äº›å»¶è¿Ÿç”»å›¾ç¨‹åºï¼Œåœ¨frameä¸Šç”»å›¾
æœ‰æ—¶æ˜¯å¿…é¡»çš„ï¼Œè€Œä¸€èˆ¬è¯´æ¥ä½¿ç”¨pictureæ¥ç”»å›¾ä¼šæ›´æ–¹ä¾¿ã€‚è¯·å‚è€ƒ\qref{Q8.8}ã€‚


\subsection{\label{Q7.3}pathå’Œguideä¹‹é—´çš„åŒºåˆ«æ˜¯ä»€ä¹ˆï¼Ÿ}

ä¸€æ¡pathæ˜¯ä¸€æ¡å…·æœ‰ç¡®å®šç«¯ç‚¹åæ&nbsp;‡çš„ä¸‰æ¬¡æ&nbsp;·æ¡æ›²çº¿ã€‚

ä¸€æ¡guideæ˜¯ä¸€æ¡æœªè§£é‡Šçš„ä¸‰æ¬¡æ&nbsp;·æ¡æ›²çº¿ï¼ˆä¸€ç³»åˆ—ä¸‰æ¬¡æ&nbsp;·æ¡æ›²çº¿çš„èŠ‚ç‚¹å’ŒæŽ§åˆ¶ç‚¹ï¼‰ã€‚
guideç±»ä¼¼pathï¼Œä¸åŒçš„æ˜¯å¯¹guideæ¥è¯´ä¸‰æ¬¡æ&nbsp;·æ¡æ›²çº¿æ˜¯å»¶è¿Ÿåˆ°ç”»å›¾çš„æ—¶å€™ï¼ˆè¿™æ—¶æ‰è¢«è§£é‡Šæˆpathï¼‰
æ‰è®¡ç®—ï¼›è¿™æ&nbsp;·ï¼Œä¸¤æ¡å…·æœ‰è‡ªç”±ç«¯ç‚¹æ¡ä»¶çš„guideä¾¿å¯ä»¥å¹³æ»‘çš„æŽ¥åˆ°ä¸€èµ·ã€‚

\subsection{\label{Q7.4}å¦‚ä½•æ–¹ä¾¿çš„å£°æ˜Žå¹¶åˆå§‹åŒ–ä¸€ä¸ªpictureçš„æ•°ç»„ï¼Ÿ}
ä½&nbsp;å¯ä»¥è‡ªå·±å†™ä¸€ä¸ªå¦‚ä¸‹çš„ç¨‹åºï¼š
\begin{lstlisting}
picture[] picture(int n) { 
  picture[] pic;
  for(int i=0; i &lt; n; ++i) { 
    pic[i]=new picture;
    size(pic[i],19cm,0);
  } 
  return pic;
} 
 
picture[] pic=picture(6);
\end{lstlisting}

\subsection{\label{Q7.5}æœ‰æ²¡æœ‰åŠžæ³•å®šä¹‰ä¸€ä¸ªä¸€èˆ¬æ€§çš„å¤„ç†æ•°ç»„çš„å‡½æ•°ï¼ˆä¹Ÿå°±æ˜¯è¯´å¯¹ä»»ä½•ç±»åž‹çš„æ•°ç»„éƒ½è¡Œï¼‰ï¼Ÿ}
ä¸€èˆ¬ç±»åž‹å°šæœªå®žçŽ°ã€‚ä½†æ˜¯è‡³å°‘ç›®å‰ä½&nbsp;å¯ä»¥è¿™æ&nbsp;·å†™ï¼š
\begin{lstlisting}
typedef string T;
include F;
\end{lstlisting}
 
\begin{lstlisting}
typedef real T;
include F;
\end{lstlisting}
å…¶ä¸­ F.asy ä¸­åŒ…å«ç±»ä¼¼å¦‚ä¸‹çš„ç±»åž‹å®šä¹‰çš„ä»£ç&nbsp;ï¼š
\begin{lstlisting}
T[] operator $(T A, T B) {return new T[] {A,B};}
\end{lstlisting}

\subsection{\label{Q7.6}æœ‰æ²¡æœ‰åŠžæ³•åœ¨å®šä¹‰ä¸€ä¸ªç»“æž„ä¹‹å‰å£°æ˜Žå®ƒï¼Œä¾‹å¦‚ç»“æž„Aä¸­æ‰§è¡ŒæŸç§å¯¹ç»“æž„Bçš„æ“ä½œä½†æ˜¯ç»“æž„Bä¸­åŒ…å«Aç±»åž‹çš„æˆå‘˜ï¼Ÿ}
Asymptoteä¸æ”¯æŒæ•°æ®ç±»åž‹çš„æå‰å£°æ˜Žã€‚ç„¶è€Œä½&nbsp;å¯ä»¥åµŒå¥—ç»“æž„ï¼Œä»¥ä¾¿ä¸¤ä¸ªç±»åž‹å¯¹ä¸¤ä¸ªç»“æž„ä½“å®šä¹‰ä¸­çš„æŸäº›éƒ¨åˆ†éƒ½å¯è§ã€‚ä¾‹å¦‚ï¼š

\begin{lstlisting}
struct B { 
typedef void someroutine(B b);
 
static struct A { 
someroutine routine;
void init(someroutine routine) { 
this.routine=routine;
} 
} 
 
A a=new A;
string test="Testing";
} 
 
typedef B.A A;
 
A operator init() {return new A;} 
B operator init() {return new B;} 
 
 
A a;
a.init(new void(B b){write(b.test);});
 
B b;
a.routine(b);
\end{lstlisting}

\subsection{\label{Q7.7}forå¾ªçŽ¯ä¸­çš„é™æ€å˜é‡æ˜¯åœ¨ä»€ä¹ˆåœ°æ–¹åˆ†é…
   \protect\footnote{è¯‘è€…æ³¨ï¼šæ‰€è°“â€œåˆ†é…ï¼ˆallocateï¼‰â€æŒ‡è¢«åˆ†é…å†…å­˜åœ°å€ï¼Œè¢«åˆ†é…åœ°å€æ&nbsp;‡å¿—ç€ä¸€ä¸ªå˜é‡çš„è¯žç”Ÿã€‚}çš„ï¼Ÿ}

åœ¨ä¸‹é¢ä¾‹å­ä¸­
\begin{lstlisting}
void f() { 
  for(int i=0; i &lt; 3; ++i) { 
    static int n;
    ++n;
    write(n);
  }
} 

f(); // è¾“å‡º 1, 2, 3
f(); // è¾“å‡º 4, 5, 6 ï¼Œæ­¤è¡Œä¸ºè¯‘è€…æ·»åŠ&nbsp;
\end{lstlisting}
å…¶ä¸­çš„ \verb|static| é™å®šè¯æ„å‘³ç€å˜é‡ \verb|n| ä¸åªæ˜¯åœ¨ \verb|for| å¾ªçŽ¯å¤–é¢åˆ†é…çš„ï¼Œ
è€Œä¸”è¿˜æ˜¯åœ¨å‡½æ•°ä¹‹å¤–ã€‚å¦‚æžœä½&nbsp;å¤šæ¬¡è°ƒç”¨ \verb|f| å°±ä¼šæ¸…æ¥šï¼Œä»ç„¶åªæœ‰ä¸€ä¸ª \verb|n| çš„å®žä¾‹ã€‚

ä¸€ä¸ªå˜é‡çš„â€œçº§åˆ«ï¼ˆlevelï¼‰â€ï¼ˆè¢«åˆ†é…çš„åœ°æ–¹ï¼‰å’Œå®ƒçš„â€œä½œç”¨åŸŸï¼ˆscopeï¼‰â€ï¼ˆé€šè¿‡å˜é‡åèƒ½å¤Ÿå¼•ç”¨å®ƒçš„èŒƒå›´ï¼‰æ˜¯æ²¡æœ‰å…³ç³»çš„ã€‚
èŠ±æ‹¬å·æ‹¬èµ·æ¥çš„éƒ¨åˆ†åªå½±å“ä¸€ä¸ªå˜é‡çš„ä½œç”¨åŸŸè€Œä¸å½±å“å®ƒçš„çº§åˆ«ã€‚

åœ¨é¡¶çº§ä»£ç&nbsp;\footnote{è¯‘è€…æ³¨ï¼ˆæœªå¿…æ­£ç¡®ï¼Œä»…ä¾›å‚è€ƒï¼‰ï¼šAsymptoteä¸­â€œçº§åˆ«â€çš„å«ä¹‰ä¸ŽC++ä¸­å¹¶ä¸ä¸€æ&nbsp;·ï¼Œéœ€è¦æ³¨æ„ã€‚Asymptoteä¸­é™æ€å˜é‡æ˜¯åœ¨å®ƒçš„ä¸Šä¸€çº§
ä»£ç&nbsp;ä¸­åˆ†é…çš„ï¼Œä¸”è¯‘è€…å‘çŽ°ä¸åŒçš„çº§åˆ«æ˜¯ç”±äºŽåœ¨å‡½æ•°æˆ–ç»“æž„ä½“å†…å®šä¹‰äº§ç”Ÿçš„ï¼Œä½†æ˜¯è±¡ \verb|for| å¾ªçŽ¯ç­‰çš„èŠ±æ‹¬å·å¹¶ä¸ä¼šæ”¹å˜åœ¨å…¶
ä¸­å®šä¹‰çš„é™æ€å˜é‡çš„çº§åˆ«ï¼›è€Œåœ¨C++ä¸­ï¼Œé™æ€å˜é‡ä¼¼ä¹Žå°±æ˜¯åœ¨ç´§åŒ…å›´å…¶å®šä¹‰çš„èŠ±æ‹¬å·å†…åˆ†é…çš„ï¼Œå›&nbsp;è€Œç±»ä¼¼C++ä»£ç&nbsp;ï¼ˆå‡è®¾ä½äºŽé¡¶çº§çš„ \verb|main| å‡½æ•°ä¸­ï¼‰
\verb|for(int i=0; i&lt;3; ++i) \{ static int n; ++n; printf("\%d ",n); \}| åˆ™è¾“å‡º1 2 3ã€‚}ä¸­é™æ€ä¿®é¥°ç¬¦ \verb|static| æ²¡æœ‰æ„ä¹‰ï¼Œ
å®ƒä¼šäº§ç”Ÿè­¦å‘Šç„¶åŽè¢«å¿½ç•¥ï¼š
\begin{lstlisting}
for(int i=0; i &lt; 3; ++i) { 
  static int n;
  ++n;
  write(n);
}
// è¾“å‡ºå…³äºŽé¡¶çº§é™æ€ä¿®é¥°ç¬¦çš„è­¦å‘Šï¼Œç„¶åŽè¾“å‡º 1, 1, 1
\end{lstlisting}

è‡ªä»Ž1.22ç‰ˆæœ¬ï¼Œå¾ªçŽ¯ä½“ä¸­åˆ†é…çš„éžé™æ€å˜é‡åœ¨æ¯ä¸ªå¾ªçŽ¯ä¸­éƒ½æ˜¯é‡æ–°åˆ†é…çš„ã€‚è¿™åªæœ‰åœ¨æ¯”è¾ƒ
æ™¦æ¶©çš„ä»£ç&nbsp;ä¸­æ‰éœ€è¦æ³¨æ„ï¼Œæ¯”å¦‚å¾ªçŽ¯ä¸­çš„å˜é‡è¢«åœ¨å¾ªçŽ¯ä½“å†…å®šä¹‰çš„ä¸€ä¸ªå‡½æ•°è®¿é—®çš„æƒ…å†µï¼š

\begin{lstlisting}
int f();
 
for(int i=0; i &lt; 10; ++i) { 
  int j=10*i;
  if(i == 5)
    f=new int() {return j;};
} 
 
write(f()); // è¾“å‡º 50
\end{lstlisting}

å¾ªçŽ¯ä½“ä¸­çš„å˜é‡æœ€å¤šå­˜æ´»åˆ°é‚£ä¸€å¾ªçŽ¯çš„ç»“æŸï¼Œé™¤éžå®ƒä»¬è¢«ä¸€ä¸ªå‡½æ•°å®šä¹‰å¼•ç”¨è€Œè¢«å»¶é•¿ç”Ÿå‘½æœŸï¼Œå°±åƒä¸Šé¢çš„ä»£ç&nbsp;é‚£æ&nbsp;·ã€‚
åœ¨ä¸€ä¸ªå‡½æ•°ä½“å†…ï¼Œå˜é‡è‡³å°‘å­˜æ´»åˆ°å‡½æ•°è¢«è°ƒç”¨å®Œï¼Œä¸è¿‡ç”±äºŽå‡½æ•°å®šä¹‰æˆ–å†…å­˜åžƒåœ¾æ”¶é›†ç¨‹åºå…¶ç”Ÿå‘½æœŸå¯èƒ½ä¼šè¢«å»¶é•¿ã€‚
å¦‚æžœä¸€ä¸ªå˜é‡æ˜¯åœ¨æ–‡ä»¶çš„é¡¶çº§æˆ–äº¤äº’å¼æç¤ºç¬¦ä¸‹å®šä¹‰çš„ï¼Œé‚£ä¹ˆå®ƒè‡³å°‘å­˜æ´»åˆ°æ–‡ä»¶æœ«å°¾æˆ–é‚£æ¬¡äº¤äº’è¿è¡Œçš„ç»“æŸã€‚


\subsection{\label{Q7.8}æœ‰æ²¡æœ‰asyç¨‹åºçš„è°ƒè¯•å™¨ï¼Ÿ}
æœ‰çš„ï¼ŒAsymptoteæœ‰ä¸€ä¸ªåŸºäºŽè¡Œçš„è°ƒè¯•å™¨ï¼š \url{http://asymptote.sourceforge.net/doc/Debugger}ã€‚

\subsection{\label{Q7.9}ä½&nbsp;ä»¬æŽ¥å—Asymptoteçš„è¡¥ä¸å—ï¼Ÿ}

æŽ¥å—ã€‚äº‹å®žä¸Šæˆ‘ä»¬å¸Œæœ›ç”¨æˆ·èƒ½æäº¤åŒ…å«æ–°ç‰¹æ€§çš„è¡¥ä¸ï¼ˆåˆ° \url{http://sourceforge.net/tracker/?atid=685685&amp;group_id=120000}ã€‚ï¼‰ï¼Œ
è€Œä¸æ˜¯åªé&nbsp;æˆ‘ä»¬æ¥å®Œæˆæ‰€æœ‰ä»£ç&nbsp;ã€‚æœ‰å¤§å®¶å‚ä¸Žå¼€å‘æ‰ä¼šæ›´å¿«ï¼

\section{\label{Q8}å…³äºŽAsymptoteå’ŒMetaPostä¹‹é—´åŒºåˆ«çš„é—®é¢˜}
\subsection{\label{Q8.1}Asymptoteä¸­ä»€ä¹ˆä¸ŽMetaPostä¸­çš„æ’å€¼ç®—ç¬¦ c[a,b] ç­‰ä»·ï¼Ÿ}

\begin{lstlisting}
interp(a,b,c);
\end{lstlisting}

\subsection{\label{Q8.2}å›¾çš„ç¼©æ”¾åœ¨Asymptoteå’ŒMetaPostä¸­æœ‰ä½•ä¸åŒï¼Ÿ}
Asymptoteæä¾›äº†ä¸€ç§å¯é€‰çš„ä¾¿åˆ©æ–¹å¼æ¥è‡ªåŠ¨ç¼©æ”¾åˆ°ç»™å®šçš„å›¾ç‰‡å°ºå¯¸ï¼Œè€ŒMetaPoståªæ”¯æŒæ‰‹åŠ¨ç¼©æ”¾ã€‚
Asymptoteå»¶è¿Ÿç»˜åˆ¶å°†è¦ç”»åœ¨å›¾ä¸Šçš„å¯¹è±¡ï¼Œå¹¶ä¸”å®ƒåŒºåˆ†çœŸå®žå°ºå¯¸å¯¹è±¡å’Œéœ€è¦æ&nbsp;¹æ®å›¾å°ºå¯¸è¿›è¡Œç¼©æ”¾çš„å¯¹è±¡ã€‚
ç”±æ­¤äº§ç”Ÿçš„çº¿æ€§è§„åˆ’é—®é¢˜é€šè¿‡å•çº¯å½¢æ–¹æ³•\footnote{è¯‘è€…æ³¨ï¼šâ€œå•çº¯å½¢æ–¹æ³•ï¼ˆsimplex methodï¼‰â€æ˜¯ä¸€ç§æœ‰æ•ˆ
æ±‚è§£çº¿æ€§è§„åˆ’ï¼ˆlinear programmingï¼‰é—®é¢˜çš„æ•°å­¦æ–¹æ³•ã€‚}è§£å‡ºã€‚

å…³äºŽæ—¢åŒ…å«ç”¨æˆ·åæ&nbsp;‡åˆåŒ…å«çœŸå®žå°ºå¯¸ï¼ˆPostScriptï¼‰åæ&nbsp;‡çš„å»¶è¿Ÿç»˜åˆ¶çš„ä¾‹å­ï¼Œå¯ä»¥
å‚è€ƒ \url{http://asymptote.sourceforge.net/gallery/dimension.asy}ã€‚

\subsection{\label{Q8.3}å¦‚ä½•é¿å…å›¾çš„è‡ªåŠ¨ç¼©æ”¾ï¼Ÿ}
å¦‚æžœä½&nbsp;çœŸçš„å–œæ¬¢MetaPostæ–¹æ³•çš„æ‰‹åŠ¨ï¼ˆç¡¬çº¿çš„ï¼‰ç¼©æ”¾çš„è¯ï¼Œä½&nbsp;å¯ä»¥ï¼š

(1) å¯¹æ•´ä¸ªå›¾ä½¿ç”¨é»˜è®¤å°ºå¯¸ \verb|size(0,0)| å¹¶æ‰‹åŠ¨å¤„ç†æ‰€æœ‰ç¼©æ”¾ï¼Œå°±åƒåœ¨MetaPostä¸­ä¸€æ&nbsp;·ã€‚

(2) ç”»ä¸€ä¸ªç‹¬ç«‹çš„å›¾ \verb|pic| å¹¶æ‰§è¡Œ \verb|add(pic.fit())|ã€‚

(3) ä½¿ç”¨ \verb|frame|ã€‚

\subsection{\label{Q8.4}ä¸ŽMetaPostä¸­çš„ ... å‘½ä»¤ç­‰ä»·çš„æ˜¯ä»€ä¹ˆï¼Ÿ}
è¿žæŽ¥ç¬¦ \verb|::| æ˜¯ \verb|tension atleast 1| çš„å®ï¼š

\myfig{8-4}
\begin{lstlisting}
size(100);
pair z0=(0,0);
pair z1=(1,0.25);
pair z2=(2,0);
draw(z0{up}::z1{right}::z2{down});
\end{lstlisting}

\subsection{\label{Q8.5}ä¸ŽMetaPostä¸­çš„pickupå‘½ä»¤ç­‰ä»·çš„æ˜¯ä»€ä¹ˆï¼Ÿ}

åªéœ€å†™ï¼Œæ¯”å¦‚:

\begin{lstlisting}
currentpen=red;
\end{lstlisting}

\subsection{\label{Q8.6}ä¸ŽMetaPostä¸­çš„whateverå‘½ä»¤ç­‰ä»·çš„æ˜¯ä»€ä¹ˆï¼Ÿ}
Asymptoteå¹¶ä¸éšå«æ±‚è§£çº¿æ€§æ–¹ç¨‹ç»„å›&nbsp;æ­¤æ²¡æœ‰è¡¨ç¤ºæœªçŸ¥çš„ \verb|whatever| æ¦‚å¿µã€‚
è¿™ç§åŠŸèƒ½å½“ç„¶å¯ä»¥æ·»åŠ&nbsp;ä¸Šï¼ˆæ—¢ç„¶ \verb|=| è¡¨ç¤ºèµ‹å€¼ï¼Œä¹Ÿè®¸ä½¿ç”¨è®°å· \verb|?=|ï¼‰ã€‚
ç„¶è€Œï¼ŒMetaPostä¸­ \verb|whatever| çš„å¤§éƒ¨åˆ†ç”¨æ³•éƒ½å·²è¢« math.asy ä¸­çš„çš„å‡½æ•°æ‰€åŒ…æ‹¬äº†ï¼Œ
åƒ \verb|extension|ï¼š
\begin{lstlisting}
pair extension(pair P, pair Q, pair p, pair q);
\end{lstlisting}
å®ƒè¿”å›žçº¿æ®µPQåŠpqçš„å»¶é•¿çº¿çš„äº¤ç‚¹ã€‚æˆ‘ä»¬å‘çŽ°ä½¿ç”¨åƒ \verb|extension| è¿™æ&nbsp;·çš„ç¨‹åºæ„ä¹‰æ›´æ˜Žç¡®ï¼Œ
å¯¹æ–°ç”¨æˆ·ä¸è‡´äº§ç”Ÿè¿·æƒ‘ã€‚ä½†æ˜¯å¦‚æžœæœ‰äººèƒ½è¯å®žç¡®å®žæœ‰å¿…è¦æ·»åŠ&nbsp;ç±»ä¼¼ \verb|whatever| çš„åŠŸèƒ½ï¼Œ
æˆ‘ä»¬æ˜¯å¯ä»¥è€ƒè™‘çš„ã€‚ä¸Žæ­¤åŒæ—¶ï¼Œä½&nbsp;æ€»æ˜¯å¯ä»¥ä½¿ç”¨æ˜Žç¡®çš„å†…ç½®çº¿æ€§æ–¹ç¨‹ç»„æ±‚è§£ç¨‹åºæ¥æ±‚è§£çš„ï¼Œ
å†…ç½®æ–¹æ³•ä½¿ç”¨çš„æ˜¯LUåˆ†è§£ç®—æ³•ã€‚

\subsection{\label{Q8.7}å¯¹äºŽå«æœ‰ä¸‰ä¸ªçº¿æ€§æ–¹ç¨‹ä¸”å…·æœ‰ä¸‰ä¸ªæœªçŸ¥é‡: horiz, verti, whatever çš„çº¿æ€§æ–¹ç¨‹ç»„ï¼Œ MetaPost ä¸­çš„æ–¹ç¨‹  lray - horiz*v - verti*u = whatever*( LightSource - R ); åœ¨ Asymptote çš„å¯¹åº”çš„åšæ³•æ˜¯ä»€ä¹ˆå‘¢ï¼Ÿ}
æ—¢ç„¶ \verb|horiz*v+verti*u| å¼&nbsp;å¼€ä¸€ä¸ªå¹³é¢ï¼Œä½&nbsp;å¯ä»¥ç”¨
\begin{lstlisting}
real intersect(vector P, vector Q, vector n, vector Z);
\end{lstlisting}
æ¥æ‰¾å‡ºç›¸åº”äºŽç›´çº¿ \verb|lray-whatever*(LightSource - R)| çš„äº¤ç‚¹æ—¶åˆ»\footnote{è¯‘è€…æ³¨ï¼šAsymptoteä¸­çš„æœ¯è¯­â€œtimeâ€ï¼Œè¿™é‡Œæš‚è¯‘ä¸ºâ€œæ—¶åˆ»â€ã€‚}
ç„¶åŽå†ä»Žä¸­èŽ·å–ä¸‰ä¸ªè¦æ±‚çš„å€¼ã€‚ï¼ˆä½&nbsp;ä»å°†éœ€è¦ç”¨å†…ç½®æ˜¾å¼çº¿æ€§æ±‚è§£ç¨‹åºæ¥è§£ä¸€ä¸ª $2\times 2$ æ–¹ç¨‹ç»„æ¥å¾—åˆ° \verb|horiz| å’Œ \verb|verti|ã€‚ï¼‰

\subsection{\label{Q8.8}åœ¨MetaPostä¸­ï¼Œå¯ä»¥é€šè¿‡å®šä¹‰ä¸€ä¸ªå•ä½ u å¹¶æ˜Žç¡®ä¹˜åœ¨æ¯ä¸ªåæ&nbsp;‡ä¸Šçš„æ–¹æ³•æ¥å®žçŽ°æ‰€ç”»çš„å›¾å½¢åœ¨ä¸åŒçš„å›¾ä¸­å…·æœ‰ç›¸åŒçš„å°ºå¯¸ã€‚
åœ¨Asymptoteä¸­æœ‰æ²¡æœ‰æ›´å¥½çš„åŠžæ³•æ¥å®žçŽ°ï¼Ÿ}
æœ‰çš„ï¼ŒAsymptoteæœ‰æ›´å¥½çš„åŠžæ³•ï¼šä½&nbsp;è‚¯å®šä¸æƒ³æ‰‹åŠ¨ç¼©æ”¾æ‰€æœ‰çš„åæ&nbsp;‡ã€‚è¦è®©ç”¨æˆ·åæ&nbsp;‡ä»£è¡¨1cmçš„å€æ•°ï¼Œåªéœ€ï¼š

\myfig{8-8a}
\begin{lstlisting}
unitsize(1cm);
draw(unitsquare);
\end{lstlisting}
ä½&nbsp;ä¹Ÿå¯ä»¥æŒ‡å®šä¸åŒçš„ $x$ å’Œ $y$ å•ä½ï¼š
\myfig{8-8b}
\begin{lstlisting}
unitsize(x=1cm,y=2cm);
draw(unitsquare);
\end{lstlisting}
å¦ä¸€ä¸ªæ–¹æ³•æ˜¯æŠŠä½&nbsp;çš„å›ºå®šå°ºå¯¸çš„å¯¹è±¡ç”»åˆ°æ¡†æž¶ä¸Šå†æŠŠå®ƒæ·»åŠ&nbsp;åˆ° \verb|currentpicture| ä¸Šï¼š
\myfig{8-8c}
\begin{lstlisting}
path p=(0,0)--(1,0);
frame object;
draw(object,scale(100)*p);
 
add(object);
add(object,(0,-10));
\end{lstlisting}
ä¸ºäº†ç†è§£ \verb|frame| å’Œ \verb|picture| çš„åŒºåˆ«ï¼Œè¯·å°è¯•å¦‚ä¸‹ä»£ç&nbsp;\footnote{è¯‘è€…æ³¨ï¼šè¿™é‡Œ
ä»£ç&nbsp;æœ€åŽçš„é‚£å¥ \verb|add(object,(0,-10));| ä¸­ï¼Œè™½ç„¶å‚æ•°ä¸­çš„ \verb|object|æ˜¯ä¸€ä¸ª \verb|picture|åž‹å¯¹è±¡ï¼Œ
ä½†æ˜¯å®žé™…æ·»åŠ&nbsp;çš„å´æ˜¯ \verb|object.fit()|ï¼Œä¹Ÿå°±æ˜¯è¯´æ˜¯ä¸€ä¸ª \verb|frame| å¯¹è±¡ï¼Œæ‰€ä»¥è¿™é‡Œçš„æ¯”è¾ƒæ‰æœ‰æ„ä¹‰ã€‚ä»Ž
æ‰‹å†Œä¸­ \verb|add| å‡½æ•°çš„åŽŸåž‹ä¸­å¯ä»¥çœ‹å‡ºï¼Œåªè¦æŒ‡å®šäº†ä½ç½®å‚æ•°ï¼ˆ\verb|pair| ç±»åž‹ï¼‰ï¼Œé‚£ä¹ˆä¸ç®¡è¢«æ·»åŠ&nbsp;çš„æ˜¯ \verb|picture|è¿˜æ˜¯
\verb|frame|ï¼Œå…¶å®žéƒ½æ˜¯æŒ‰ \verb|frame| æ–¹å¼çš„PostScriptåæ&nbsp;‡å¤„ç†çš„ã€‚}ï¼š
\myfig{8-8d}
~\\[-5mm]
\begin{lstlisting}
size(300,300);
 
path p=(0,0)--(1,0);
picture object;
draw(object,scale(100)*p);
 
add(object);
add(object,(0,-10)); // æ·»åŠ&nbsp;çœŸå®žå°ºå¯¸å¯¹è±¡åˆ° currentpicture 
\end{lstlisting}

\subsection{\label{Q8.9}åœ¨MetaPostä¸­å¯ä»¥é€šè¿‡å…ˆç”Ÿæˆä¸€ä¸ªå›¾å†å°†å…¶è£å‰ªæˆä¸€ä¸ªå›´ç»•å…¶ä¸­å¿ƒçš„å›ºå®šå¤§å°çš„çŸ©å½¢æ¥åˆ¶ä½œå¡«å……ç”¨çš„å›¾æ¡ˆï¼Œåœ¨Asymptoteä¸­å¦‚ä½•å®žçŽ°ï¼Ÿ}
å¦‚æžœä½&nbsp;æ­£åœ¨åƒåœ¨MetaPostä¸­é‚£æ&nbsp;·ä½¿ç”¨ \verb|currentpicture| ï¼ˆä½¿ç”¨PostScriptåæ&nbsp;‡ç›´æŽ¥ç”»ï¼‰çš„è¯ï¼Œ
ä½&nbsp;åªéœ€ç®€å•çš„è¿™æ&nbsp;·åšï¼š
\myfig{8-9a}
\begin{lstlisting}
fill((0,0)--(100,100)--(200,0)--cycle);
 
pair center(picture pic=currentpicture) {return 0.5*(pic.min()+pic.max());} 
 
real height=100;
real width=100;
pair delta=0.5(width,height);
pair c=center();
clip(box(c-delta,c+delta));
\end{lstlisting}

ç„¶è€Œï¼Œä½¿ç”¨PostScriptåæ&nbsp;‡ç”»å›¾é€šå¸¸æ˜¯ä¸æ–¹ä¾¿çš„ã€‚ä»¥ä¸‹æ˜¯Asymptoteä½¿ç”¨å»¶è¿Ÿç”»å›¾æ–¹å¼æ¥å®žçŽ°çš„æ–¹æ³•ï¼š

\myfig{8-9b}
\begin{lstlisting}
size(200,100); //è¯‘è€…æ³¨ï¼šè¿™é‡ŒåŽŸæ¥æ˜¯ size(200,0); ä½†å¾—åˆ°çš„ç»“æžœä¸Žä¸Šé¢çš„ä¸ä¸€æ&nbsp;·ã€‚
fill((0,0)--(1,1)--(2,0)--cycle);
 
void clip(picture pic=currentpicture, real width, real height) 
{
pic.clip(new void (frame f, transform) { 
pair center=0.5(min(f)+max(f));
pair delta=0.5(width,height);
clip(f,box(center-delta,center+delta));
});
} 
 
clip(100,100);
\end{lstlisting}

è¿˜å¯å‚è€ƒæ–‡æ¡£ä¸­å…³äºŽå¡«å……ï¼ˆtilingï¼‰çš„è®¨è®º \url{http://asymptote.sourceforge.net/doc/Pens.html}ã€‚

\section{\label{Q9}å…³äºŽè¾“å‡ºçš„é—®é¢˜}
\subsection{\label{Q9.1}å½“å¤„ç†å®Œä¸€ä¸ªasyæ–‡ä»¶åŽå¦‚ä½•ç¦æ­¢å¯¹PSæŸ¥çœ‹å™¨çš„è‡ªåŠ¨è°ƒç”¨ï¼Ÿ}
äº‹å®žä¸Šé»˜è®¤æ˜¯ä¸è‡ªåŠ¨è°ƒç”¨çš„ï¼Œé™¤éžä½&nbsp;æ°å¥½æ˜¯åœ¨ç”¨å¾®è½¯Windowsï¼ˆå›&nbsp;ä¸ºé‚£æ&nbsp;·æ­£æ˜¯å¤§éƒ¨åˆ†Windowsç”¨æˆ·æ‰€å¸Œæœ›çš„ï¼‰ã€‚
Windowsç”¨æˆ·å¯ä»¥é€šè¿‡å‘½ä»¤è¡Œé€‰é¡¹ -noV æ¥ç¦æ­¢å®ƒï¼Œæˆ–è€…æŠŠå¦‚ä¸‹ä»£ç&nbsp;æ”¾å…¥ config.asy æ–‡ä»¶ä¸­ï¼š
\begin{lstlisting}
import settings;
interactiveView=false;
batchView=false;
\end{lstlisting}
è¯·å‚è€ƒ \url{http://asymptote.sourceforge.net/doc/Options.html}ã€‚

\subsection{\label{Q9.2}å¦‚ä½•è¾“å‡ºæˆjpegå›¾åƒï¼Ÿ}
å¦‚æžœä½&nbsp;å·²æ­£ç¡®å®‰è£… ImageMagick è½¯ä»¶åŒ…ä¸­çš„ covert ç¨‹åºï¼Œåªéœ€è¾“å…¥
\begin{verbatim}
asy -f jpg test.asy 
\end{verbatim}

\subsection{\label{Q9.3}æˆ‘èƒ½å¦åµŒå…¥ä½å›¾ï¼ˆç…§ç‰‡ï¼‰å¹¶æŒ‡å®šä½ç½®ä»¥åŠå¯¹å…¶ç¼©æ”¾ï¼Ÿ}
æŠŠå®ƒä»¬è½¬æ¢æˆepsæ&nbsp;¼å¼å¹¶ä½¿ç”¨ \verb|graphic(string)| å‡½æ•°ï¼Œå°±åƒä¸€ä¸ªæ&nbsp;‡æ³¨ï¼š

\begin{lstlisting}
label(graphic("file"),(0,0));
\end{lstlisting}
è¯·å‚è€ƒä¾‹å­ \url{http://asymptote.sourceforge.net/gallery/orthocenter.asy} å’Œ 
\url{http://asymptote.sourceforge.net/doc/label.html}ã€‚

\subsection{\label{Q9.4}Asymptoteæ˜¯å¦æ”¯æŒç›´æŽ¥PDFè¾“å‡ºï¼Ÿ}
ç›®å‰ï¼Œå½“ä½¿ç”¨ \verb|-f pdf| é€‰é¡¹æ—¶æ˜¯æ”¯æŒPDFè½¬æ¢çš„ï¼Œæ”¯æŒé€æ˜Žã€æ³¨è®°ä»¥åŠåµŒå…¥è§†é¢‘å’Œu3då›¾åƒã€‚
ç„¶è€Œï¼Œæˆ‘ä»¬è®¡åˆ’æœ€ç»ˆå®žçŽ°ç›´æŽ¥çš„PDFè¾“å‡ºï¼Œä»¥æ”¯æŒé‚£äº›åœ¨PostScriptä¸­ä¸èƒ½ç”¨çš„ç‰¹æ€§ï¼ˆæ¯”å¦‚æ&nbsp;¹æ®ä¸€èˆ¬å‡½æ•°çš„ç€è‰²å¤„ç†ï¼‰ã€‚

\subsection{\label{Q9.5}å¦‚ä½•åˆ¶ä½œå…‰æ&nbsp;…æ‰«ææ&nbsp;¼å¼ï¼ˆæ¯”å¦‚pngã€giffç­‰ï¼‰çš„é«˜è´¨é‡çš„å¤§å›¾ï¼Ÿ}
å°è¯•ä½¿ç”¨ä¸€äº›é€‰é¡¹æ¥è½¬æ¢ï¼Œä¸»è¦æ˜¯ \verb|-geometry| å’Œ \verb|-density|ã€‚ä¾‹å¦‚ï¼š
\begin{verbatim}
convert -geometry 1000x3000 example.eps example.png 
\end{verbatim}
åº”è¯¥ç»™å‡ºä½&nbsp;æƒ³è¦çš„åƒç´&nbsp;ã€‚

ä½&nbsp;ä¹Ÿå¯ä»¥å¦‚ä¸‹æ”¹å˜å›¾åƒçš„é»˜è®¤åˆ†è¾¨çŽ‡ï¼š
\begin{verbatim}
convert -geometry 1000x3000 -density 300 -units PixelsPerInch example.eps example.png 
\end{verbatim}
è¿™æ&nbsp;·ä¸æ”¹å˜å›¾åƒçš„åƒç´&nbsp;æ•°ï¼Œåªæ˜¯ç»™å‡ºä¸€ä¸ªæ¯ä¸ªåƒç´&nbsp;åº”è¯¥æ˜¾ç¤ºå¤šå¤§çš„æç¤ºã€‚

å¦‚æžœä½&nbsp;ç”¨äº† \verb|-density| å´æ²¡æœ‰ç”¨ \verb|-geometry| é€‰é¡¹ï¼Œ convert ç¨‹åºå°†ä¿æŒå›¾åƒå°ºå¯¸ä¸å˜
ï¼ˆå›&nbsp;æ­¤ä¸€ä¸ª 4cm$\times$3cm çš„epså›¾å°†äº§ç”Ÿä¸€ä¸ª4cm$\times$3cm çš„pngå›¾ï¼‰ã€‚

\subsection{\label{Q9.6}ç”¨Asymptoteå¯ä»¥ç”Ÿæˆå¤šé¡µæ–‡æ¡£å—ï¼Ÿ}
å¯ä»¥ï¼Œåªéœ€è°ƒç”¨ \verb|newpage()| å‡½æ•°ã€‚ç”¨ slide.asy æ¥åˆ¶ä½œé«˜è´¨é‡çš„å¹»ç¯ç‰‡æ—¶å°±è¿™ä¹ˆä½¿ç”¨ï¼ˆæ¯”Prosperæ›´æ–¹ä¾¿ä½¿ç”¨ï¼‰ã€‚


\end{document}
</pre></body></html>