summaryrefslogtreecommitdiff
path: root/info/asymptote-faq-zh-cn/src/figures/6-12.asy
diff options
context:
space:
mode:
Diffstat (limited to 'info/asymptote-faq-zh-cn/src/figures/6-12.asy')
-rw-r--r--info/asymptote-faq-zh-cn/src/figures/6-12.asy24
1 files changed, 24 insertions, 0 deletions
diff --git a/info/asymptote-faq-zh-cn/src/figures/6-12.asy b/info/asymptote-faq-zh-cn/src/figures/6-12.asy
new file mode 100644
index 0000000000..fd66337452
--- /dev/null
+++ b/info/asymptote-faq-zh-cn/src/figures/6-12.asy
@@ -0,0 +1,24 @@
+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);
+