Debian Codegraph @

texmf-dist/doc/latex/circuit-macros/examples/Geometry.m4

raw
1 .PS
2 # Geometry.m4
3 # Some constructions from https://tex.stackexchange.com/
4 gen_init
5 maxpswid = 9
6 Scaled: [
7 Fig1: [
8 # FourbarSVG.m4
9 # https://tex.stackexchange.com/questions/563831/how-to-draw-four-bar-linkage-with-center-of-mass
10 ls = 1/25.4 # local scale
11
12 a = 18*ls
13 b = 73*ls
14 c = 47*ls
15 d = 72*ls
16 A0: Here
17 B0: A0+(d,0)
18 circlerad = 1*ls
19
20 define(`pivot',`[
21 C: circle
22 line down_ 4*ls from C+(2*ls,0)
23 arc from last line.start to C+(-2*ls,0) with .c at C
24 line down_ 4*ls
25 B: line thick 1.6 right 7*ls with .c at (C,Here)
26 thinlines_
27 sep = 0.9*ls
28 nhash = B.len/sep
29 for i=0 to nhash do { line down sep left sep from B.end-(i/nhash*B.len,0) }
30 thicklines_
31 ]')
32
33 pivot with .C at A0; "$A_0$" at A0-(5,0)*ls
34 circle dashed rad a at A0
35 pivot with .C at B0; "$B_0$" at B0-(5,0)*ls
36 "$d = A_0B_0$" at 0.5<A0,B0>
37
38 B1: Cintersect(A0,a+b,B0,c)
39 B2: Cintersect(A0,b-a,B0,c)
40 arc dashed from B1 to B2 with .c at B0
41
42 A0B1: line thick 1.6 from A0 to B1 chop 2*ls chop 0
43 line thick 1.6 from B0 to B1 chop 2*ls chop 0 "c" ljust
44 circle fill_(1) at B1; "$B_1$" wid 3*ls at B1+(5,0)*ls
45 A1: circle fill_(1) at LCintersect(A0B1,A0,a,R)
46 "$A_1$" at A1+(5,0)*ls
47
48 A2: b/(b-a) between B2 and A0; "$a$" at 0.4<A2,A0> above rjust
49 "$b$" at 0.4<A1,B1> above rjust
50 A2B2: line thick 1.6 from A2 to B2
51 line thick 1.6 from B0 to B2 chop 2*ls chop 0
52 circle fill_(1) at B2; "$B_2$" at B2+(5,0)*ls
53 circle fill_(1) at A2; "$A_2$" at A2+(5,0)*ls
54
55 thinlines_
56 line from B0+(3*ls,0) right 4*ls
57 ArcAngle(Here,B0,B1,5*ls) ->; "$\psi_0$" at last arc.ne above ljust
58 ArcAngle(B1,B0,B2,8*ls) ->; "$\psi$" at last arc.n+(-3*ls,0) above
59 ArcAngle(A1,A0,B2,b*0.45) ->; "$\theta$" at last arc.start+(0,4*ls)
60 line from A0+(3*ls,0) right 8*ls
61 ArcAngle(Here,A0,B1,9*ls) ->; "$\theta_0$" \
62 at last arc.start+(2,2)*ls
63 ]
64
65 Fig2: [
66 # FourbarSVG.m4
67 # https://tex.stackexchange.com/questions/609452/help-drawing-a-more-sophisticated-right-triangle-with-tikz-or-something-else
68
69 textkht = 12/72
70 unit = 0.6
71 C: Here; { "$C$" at C rjust below }
72 B: C+(4*unit,0); { "$B$" at B ljust below }
73 A: C+(0,3*unit); { "$A$" at A rjust above }
74 H: PerpTo(C,A,B); { "$H$" at H ljust above }
75 line from C to H then to B then to C shaded rgbstring(0.5,0.8,0.9)
76 line from C to H then to A then to C shaded rgbstring(0.8,0.9,0.7)
77 ArcAngle(C,A,B,unit*0.4)
78 ArcAngle(C,A,B,unit*0.5)
79 ArcAngle(A,B,C,unit*0.5,,"$\theta$" rjust)
80 ArcAngle(B,C,H,unit*0.5); {"$\theta$" at C+(unit*0.3,unit*0.17) }
81 ArcAngle(B,C,A,unit*0.6)
82 RightAngle(B,C,A,unit*0.17)
83 RightAngle(C,H,A,unit*0.17)
84 ] with .nw at Fig1.sw+(0.2,0)
85
86
87 Fig3: [ ls = 3/4 # local scale
88 # https://tex.stackexchange.com/questions/593272/drawing-complex-geometry
89 P: dot(at Here); "$P$" at P.s below
90 N: dot(at P+(3.5*ls,1.5*ls)); "$N$" at N.se ljust below
91 O: dot(at (N,P)); "$O$" at O.s below
92 R: dot(at 1/3 between O and P);"$R$" at R.s below
93 M: dot(at (R,N)); "$M$" at M.se ljust below
94 Q: dot(at (M.x,M.y+distance(M,N)/distance(N,O)*distance(P,O)));"$Q$" at Q.e ljust
95 line from P to Q then to N then to O
96 B: line to P chop -0.3
97 line from M to N
98 Pu: line from R to Q chop 0 chop -0.3
99 H: line from P to N chop 0 chop -0.3
100 X: dot(at Intersect_(Pu,H)); "$X$" at X.se ljust below
101 thinlines_
102 RightAngle(Q,M,N)
103 RightAngle(Q,N,H.end)
104 RightAngle(N,O,B.start)
105 ArcAngle(N,P,Q,0.4); "$\beta$" at last arc.ne above ljust
106 ArcAngle(O,P,N,0.5); "$\alpha$" at last arc.start+(5bp__,8bp__)
107 ArcAngle(R,Q,N,0.5); "$\alpha$" at last arc.start+(8bp__,-5bp__)
108 ] with .sw at Fig2.e+(-0.2,-0.7)
109
110 ifelse(1,1,`
111 Fig4: [ ls = 2/3 # local scale
112 A: Here; "$A$" at A above
113 B: A+(-1*ls,-3.5*ls); "$B$" at B below rjust
114 C: B+(4.6*ls,0); "$C$" at C below ljust
115 AB: line from A to B
116 BC: line from B to C
117 CA: line from C to A
118
119 perpto(A,BC,L); "$L$" at L below
120 AL: line from A to L; RightAngle(A,L,C)
121
122 angleLAC = atan2(C.x-L.x,A.y-L.y)
123 S: move from A to (sin(angleLAC/2),-cos(angleLAC/2))
124 AW: line from A to Intersect_(S,BC)
125 W: Here; "$W$" at W below rjust
126
127 perpto(C,AB,N); "$N$" at N above rjust
128 CN: line from C to N; RightAngle(C,N,B)
129
130 perpto(B,CA,M); "$M$" at M above
131 CM: line from B to M; RightAngle(B,M,C)
132
133 H: Intersect_(CN,AL); "$H$" at H +(4bp__,10bp__)
134
135 thinlines_
136 Equidist3(B,L,N,CC1,c1rad); C1: circle rad c1rad at CC1
137 Equidist3(B,W,N,CC2,c2rad); C2: circle rad c2rad at CC2
138 Equidist3(B,C,N,CC3,c3rad); C3: circle rad c3rad at CC3
139 Equidist3(W,C,M,CC4,c4rad); C4: circle rad c4rad at CC4
140 thicklines_
141
142 Z: LCintersect(AW,CC2,C2.rad); "$Z$" at Z+(-5bp__,-5bp__)
143 HZ: move from H to Z
144 Y: LCintersect(HZ,CC4,C4.rad,R); "$Y$" at Y above
145 X: LCintersect(HZ,CC2,C2.rad); "$X$" at X above rjust
146
147 foreach_(`P',`dot(at P)',X,Y,Z)
148
149 line dashed from X to Y chop -linewid/2
150 RightAngle(A,Z,Y)
151 ] with .sw at (Fig3.e,Fig2.s)
152 ')
153
154 ] scaled 0.8
155
156 .PE