| 1 |
.PS |
| 2 |
# FourbarDPV.m4 |
| 3 |
# https://tex.stackexchange.com/questions/563831/how-to-draw-four-bar-linkage-with-center-of-mass |
| 4 |
gen_init |
| 5 |
scale = 25.4 |
| 6 |
|
| 7 |
a = 18 |
| 8 |
b = 73 |
| 9 |
c = 47 |
| 10 |
d = 72 |
| 11 |
A0: Here |
| 12 |
B0: A0+(d,0) |
| 13 |
circlerad = 1 |
| 14 |
|
| 15 |
define(`pivot',`[ |
| 16 |
C: circle |
| 17 |
line down_ 4 from C+(2,0) |
| 18 |
arc from last line.start to C+(-2,0) with .c at C |
| 19 |
line down_ 4 |
| 20 |
B: line thick 1.6 right 7 with .c at (C,Here) |
| 21 |
thinlines_ |
| 22 |
sep = 0.9 |
| 23 |
nhash = B.len/sep |
| 24 |
#for i=0 to nhash do { line down sep left sep from B.start+(i/nhash*B.len,0) } |
| 25 |
for i=0 to nhash do { line down sep left sep from B.end-(i/nhash*B.len,0) } |
| 26 |
thicklines_ |
| 27 |
]') |
| 28 |
|
| 29 |
pivot with .C at A0; "svg_it(A`'svg_sub(0))" at A0-(5,0) |
| 30 |
circle dashed rad a at A0 |
| 31 |
pivot with .C at B0; "svg_it(B`'svg_sub(0))" at B0-(5,0) |
| 32 |
"svg_it(d = A`'svg_sub(0)B`'svg_sub(0))" at 0.5<A0,B0> |
| 33 |
|
| 34 |
B1: Cintersect(A0,a+b,B0,c) |
| 35 |
B2: Cintersect(A0,b-a,B0,c) |
| 36 |
arc dashed from B1 to B2 with .c at B0 |
| 37 |
|
| 38 |
A0B1: line thick 1.6 from A0 to B1 chop 2 chop 0 |
| 39 |
line thick 1.6 from B0 to B1 chop 2 chop 0 "svg_it(c)" ljust |
| 40 |
circle fill_(1) at B1; "svg_it(B`'svg_sub(1))" wid 3 at B1+(5,0) |
| 41 |
A1: circle fill_(1) at LCintersect(A0B1,A0,a,R) |
| 42 |
"svg_it(A`'svg_sub(1))" at A1+(5,0) |
| 43 |
|
| 44 |
A2: b/(b-a) between B2 and A0; "svg_it(a)" at 0.4<A2,A0> above rjust |
| 45 |
"svg_it(b)" at 0.4<A1,B1> above rjust |
| 46 |
A2B2: line thick 1.6 from A2 to B2 |
| 47 |
line thick 1.6 from B0 to B2 chop 2 chop 0 |
| 48 |
circle fill_(1) at B2; "svg_it(B`'svg_sub(2))" at B2+(5,0) |
| 49 |
circle fill_(1) at A2; "svg_it(A`'svg_sub(2))" at A2+(5,0) |
| 50 |
|
| 51 |
thinlines_ |
| 52 |
line from B0+(3,0) right 4 |
| 53 |
ArcAngle(Here,B0,B1,5) ->; "svg_psi`'svg_sub(0)" at last arc.ne above ljust |
| 54 |
ArcAngle(B1,B0,B2,8) ->; "svg_psi" at last arc.n+(-3,0) above |
| 55 |
ArcAngle(A1,A0,B2,b*0.45) ->; "svg_theta" at last arc.start+(0,4) |
| 56 |
line from A0+(3,0) right 8 |
| 57 |
ArcAngle(Here,A0,B1,9) -> ; "svg_theta`'svg_sub(0)" at last arc.start+(2,2) |
| 58 |
|
| 59 |
.PE |