Debian Codegraph @

tests/inputs/cad.asy

raw
1 // https://asymptote.sourceforge.io/gallery/CAD1.asy
2 import CAD;
3
4 sCAD cad=sCAD.Create();
5
6 /* Freehand line
7 this is a comment
8 */
9 draw(g=cad.MakeFreehand(pFrom=(3,-1)*cm,(6,-1)*cm),
10 p=cad.pFreehand);
11
12 // Standard measurement lines
13 draw(g=box((0,0)*cm,(1,1)*cm),p=cad.pVisibleEdge);
14 cad.MeasureParallel(L="$\sqrt{2}$",
15 pFrom=(0,1)*cm,
16 pTo=(1,0)*cm,
17 dblDistance=-15mm);
18
19 // Label inside,shifted to the right; arrows outside
20 draw(g=box((2,0)*cm,(3,1)*cm),p=cad.pVisibleEdge);
21 cad.MeasureParallel(L="1",
22 pFrom=(2,1)*cm,
23 pTo=(3,1)*cm,
24 dblDistance=5mm,
25 dblLeft=5mm,
26 dblRelPosition=0.75);
27
28 // Label and arrows outside
29 draw(g=box((5,0)*cm,(5.5,1)*cm),p=cad.pVisibleEdge);
30 cad.MeasureParallel(L="0.5",
31 pFrom=(5,1)*cm,
32 pTo=(5.5,1)*cm,
33 dblDistance=5mm,
34 dblLeft=10mm,
35 dblRelPosition=-1);
36
37 // Small bounds,asymmetric measurement line
38 draw(g=box((7,0)*cm,(7.5,1)*cm),p=cad.pVisibleEdge);
39 cad.MeasureParallel(L="0.5",
40 pFrom=(7,1)*cm,
41 pTo=(7.5,1)*cm,
42 dblDistance=5mm,
43 dblLeft=2*cad.GetMeasurementBoundSize(bSmallBound=true),
44 dblRight=10mm,
45 dblRelPosition=2,
46 bSmallBound=true);