8 c
.stroke(path
.line(0, 0, 4, 2), [deco
.earrow
.Large()])
9 t
= text
.text(2, 1, r
"$\vec p$")
10 t
.linealign(0.1, -2/math
.sqrt(20), 4/math
.sqrt(20))
12 c
.stroke(path
.line(0, 0, 1, 1), [deco
.earrow
.Large()])
13 t
= text
.text(0.5, 0.5, r
"$\vec a$")
14 t
.linealign(0.1, -1/math
.sqrt(2), 1/math
.sqrt(2))
16 c
.stroke(path
.line(-1, 3, 3, -1), [style
.linestyle
.dotted
])
17 c
.stroke(path
.line(1, 1, 1-1/math
.sqrt(2), 1+1/math
.sqrt(2)), [deco
.earrow
.Large()])
18 t
= text
.text(1-1/math
.sqrt(8), 1+1/math
.sqrt(8), r
"$\vec b$")
19 t
.linealign(0.1, 1/math
.sqrt(2), 1/math
.sqrt(2))
21 c
.writeEPSfile("boxalignpal")
23 ###############################################################################
26 c
.stroke(path
.line(0, 0, 4, 2), [deco
.earrow
.Large()])
27 t
= text
.text(2, 1, r
"$\vec p$")
28 t
.linealign(0.1, -2/math
.sqrt(20), 4/math
.sqrt(20))
30 c
.stroke(path
.line(0, 0, -1, 1), [deco
.earrow
.Large()])
31 t
= text
.text(-0.5, 0.5, r
"$\vec a$")
32 t
.linealign(0.1, -1/math
.sqrt(2), -1/math
.sqrt(2))
34 c
.stroke(path
.path(path
.arc(0, 0, math
.sqrt(2), 0, 360), path
.closepath()), [style
.linestyle
.dotted
])
35 c
.writeEPSfile("boxalignpac")
37 ###############################################################################
40 c
.stroke(path
.line(0, 0, 4, 2), [deco
.earrow
.Large()])
41 t
= text
.text(2, 1, r
"$\vec e$")
42 t
.linealign(0.1, -2/math
.sqrt(20), 4/math
.sqrt(20))
44 c
.stroke(path
.line(0, 0, 6, 2), [deco
.earrow
.Large()])
45 t
= text
.text(3, 1, r
"$\vec f$")
46 t
.linealign(0.1, 2/math
.sqrt(60), -6/math
.sqrt(60))
48 c
.stroke(path
.line(6, 2, 4, 2), [deco
.earrow
.Large()])
49 t
= text
.text(5, 2, r
"$\vec g$")
50 t
.linealign(0.1, 0, 1)
52 c
.stroke(path
.line(0, 0, -1, 1), [deco
.earrow
.Large()])
53 t
= text
.text(-0.5, 0.5, r
"$\vec a$")
54 t
.linealign(0.1, -1/math
.sqrt(2), -1/math
.sqrt(2))
56 c
.stroke(path
.path(path
.arc(0, 0, math
.sqrt(2), 0, 360), path
.closepath()), [style
.linestyle
.dotted
])
57 c
.stroke(path
.line(0, 0, 0, math
.sqrt(2)), [deco
.earrow
.Large()])
58 t
= text
.text(0, 1/math
.sqrt(2), r
"$\vec b$")
59 t
.linealign(0.1, -1, 0)
61 c
.writeEPSfile("boxalignlac")
63 ###############################################################################
65 def drawexample(canvas
, corner
, linealign
):
67 canvas
.stroke(path
.path(path
.arc(0, 0, r
, 0, 360)))
69 while phi
< 2 * math
.pi
+ 1e-10:
71 b
= box
.polygon(center
=(0, 0), corners
=[(0, 0), (1, 0), (0.5, math
.sqrt(3)/2)])
73 b
= box
.polygon(center
=(0, 0), corners
=[(-0.5, -math
.sqrt(3)/6), (0.5, -math
.sqrt(3)/6), (0, math
.sqrt(3)/3)])
75 b
.linealign(r
, math
.cos(phi
), math
.sin(phi
))
77 b
.circlealign(r
, math
.cos(phi
), math
.sin(phi
))
78 if round(phi
/ math
.pi
* 2 * 100) % 100:
79 canvas
.stroke(b
.path())
81 canvas
.stroke(b
.path(), [color
.rgb
.red
])
86 sc
= c
.insert(canvas
.canvas([trafo
.translate(0, d
)]))
88 sc
= c
.insert(canvas
.canvas([trafo
.translate(d
, d
)]))
90 sc
= c
.insert(canvas
.canvas([trafo
.translate(0, 0)]))
92 sc
= c
.insert(canvas
.canvas([trafo
.translate(d
, 0)]))
94 c
.text(0, 1.5*d
, "align at a circle", [text
.halign
.center
])
95 c
.text(d
, 1.5*d
, "align at tangents", [text
.halign
.center
])
96 c
.text(-0.5*d
, d
, "reference point at the triangle center", [text
.halign
.center
, trafo
.rotate(90)])
97 c
.text(-0.5*d
, 0, "reference point at a triangle corner", [text
.halign
.center
, trafo
.rotate(90)])
98 c
.writeEPSfile("boxalignexample")