| 1 |
.PS |
| 2 |
# GeometryDPV.m4 |
| 3 |
# Some constructions from https://tex.stackexchange.com/ |
| 4 |
gen_init |
| 5 |
maxpswid = 10 |
| 6 |
|
| 7 |
Fig1: [ |
| 8 |
# FourbarDPV.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`'svg_sub(0)" at A0-(5,0)*ls |
| 34 |
circle dashed rad a at A0 |
| 35 |
pivot with .C at B0; "B`'svg_sub(0)" at B0-(5,0)*ls |
| 36 |
"d = A`'svg_sub(0)B`'svg_sub(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`'svg_sub(1)" wid 3*ls at B1+(5,0)*ls |
| 45 |
A1: circle fill_(1) at LCintersect(A0B1,A0,a,R) |
| 46 |
"A`'svg_sub(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`'svg_sub(2)" at B2+(5,0)*ls |
| 53 |
circle fill_(1) at A2; "A`'svg_sub(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) ->; "svg_psi`'svg_sub(0)" at last arc.ne above ljust |
| 58 |
ArcAngle(B1,B0,B2,8*ls) ->; "svg_psi" at last arc.n+(-3*ls,0) above |
| 59 |
ArcAngle(A1,A0,B2,b*0.45) ->; "svg_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) ->; "svg_theta`'svg_sub(0)" \ |
| 62 |
at last arc.start+(2,2)*ls |
| 63 |
] |
| 64 |
|
| 65 |
Fig2: [ |
| 66 |
# FourbarDPV.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 B then to C shaded "CornflowerBlue" |
| 77 |
line from C to H then to A then to C shaded rgbstring(0.8,0.9,0.7) |
| 78 |
# line from C to H then to A then to C shaded "SpringGreen" |
| 79 |
ArcAngle(C,A,B,unit*0.4) |
| 80 |
ArcAngle(C,A,B,unit*0.5) |
| 81 |
ArcAngle(A,B,C,unit*0.5,,"svg_theta" rjust) |
| 82 |
ArcAngle(B,C,H,unit*0.5); {"svg_theta" at C+(unit*0.3,unit*0.17) } |
| 83 |
ArcAngle(B,C,A,unit*0.6) |
| 84 |
RightAngle(B,C,A,unit*0.17) |
| 85 |
RightAngle(C,H,A,unit*0.17) |
| 86 |
] with .nw at Fig1.sw+(0.2,0) |
| 87 |
|
| 88 |
|
| 89 |
Fig3: [ ls = 3/4 # local scale |
| 90 |
# https://tex.stackexchange.com/questions/593272/drawing-complex-geometry |
| 91 |
P: dot(at Here); "P" at P.s below |
| 92 |
N: dot(at P+(3.5*ls,1.5*ls)); "N" at N.se ljust below |
| 93 |
O: dot(at (N,P)); "O" at O.s below |
| 94 |
R: dot(at 1/3 between O and P);"R" at R.s below |
| 95 |
M: dot(at (R,N)); "M" at M.se ljust below |
| 96 |
Q: dot(at (M.x,M.y+distance(M,N)/distance(N,O)*distance(P,O)));"Q" at Q.e ljust |
| 97 |
line from P to Q then to N then to O |
| 98 |
B: line to P chop -0.3 |
| 99 |
line from M to N |
| 100 |
Pu: line from R to Q chop 0 chop -0.3 |
| 101 |
H: line from P to N chop 0 chop -0.3 |
| 102 |
X: dot(at Intersect_(Pu,H)); "X" at X.se ljust below |
| 103 |
thinlines_ |
| 104 |
RightAngle(Q,M,N) |
| 105 |
RightAngle(Q,N,H.end) |
| 106 |
RightAngle(N,O,B.start) |
| 107 |
ArcAngle(N,P,Q,0.4); "svg_beta" at last arc.ne above ljust |
| 108 |
ArcAngle(O,P,N,0.5); "svg_alpha" at last arc.start+(5bp__,8bp__) |
| 109 |
ArcAngle(R,Q,N,0.5); "svg_alpha" at last arc.start+(8bp__,-5bp__) |
| 110 |
] with .sw at Fig2.e+(-0.2,-0.7) |
| 111 |
|
| 112 |
Fig4: [ ls = 2/3 # local scale |
| 113 |
A: Here; "A" at A above |
| 114 |
B: A+(-1*ls,-3.5*ls); "B" at B below rjust |
| 115 |
C: B+(4.6*ls,0); "C" at C below ljust |
| 116 |
AB: line from A to B |
| 117 |
BC: line from B to C |
| 118 |
CA: line from C to A |
| 119 |
|
| 120 |
perpto(A,BC,L); "L" at L below |
| 121 |
AL: line from A to L; RightAngle(A,L,C) |
| 122 |
|
| 123 |
angleLAC = atan2(C.x-L.x,A.y-L.y) |
| 124 |
S: move from A to (sin(angleLAC/2),-cos(angleLAC/2)) |
| 125 |
AW: line from A to Intersect_(S,BC) |
| 126 |
W: Here; "W" at W below rjust |
| 127 |
|
| 128 |
perpto(C,AB,N); "N" at N above rjust |
| 129 |
CN: line from C to N; RightAngle(C,N,B) |
| 130 |
|
| 131 |
perpto(B,CA,M); "M" at M above |
| 132 |
CM: line from B to M; RightAngle(B,M,C) |
| 133 |
|
| 134 |
H: Intersect_(CN,AL); "H" at H +(4bp__,10bp__) |
| 135 |
|
| 136 |
thinlines_ |
| 137 |
Equidist3(B,L,N,CC1,c1rad); C1: circle rad c1rad at CC1 |
| 138 |
Equidist3(B,W,N,CC2,c2rad); C2: circle rad c2rad at CC2 |
| 139 |
Equidist3(B,C,N,CC3,c3rad); C3: circle rad c3rad at CC3 |
| 140 |
Equidist3(W,C,M,CC4,c4rad); C4: circle rad c4rad at CC4 |
| 141 |
thicklines_ |
| 142 |
|
| 143 |
Z: LCintersect(AW,CC2,C2.rad); "Z" at Z+(-5bp__,-5bp__) |
| 144 |
HZ: move from H to Z |
| 145 |
Y: LCintersect(HZ,CC4,C4.rad,R); "Y" at Y above |
| 146 |
X: LCintersect(HZ,CC2,C2.rad); "X" at X above rjust |
| 147 |
|
| 148 |
foreach_(`P',`dot(at P)',X,Y,Z) |
| 149 |
|
| 150 |
line dashed from X to Y chop -linewid/2 |
| 151 |
RightAngle(A,Z,Y) |
| 152 |
] with .sw at (Fig3.e,Fig2.s) |
| 153 |
|
| 154 |
.PE |