Debian Codegraph @

texmf-dist/doc/latex/circuit-macros/examples/extras/PerpTo.m4

raw
1 .PS
2 # PerpTo.m4
3 # https://tex.stackexchange.com/questions/666411/repetitive-perpendiculars-in-a-right-angle-triangle
4 gen_init
5
6 O: (0,0)
7 A: (5,0)
8 B: (0,3)
9
10 define drawperp { #( depth, O, A, B )
11 [ d = $1; O[d]: $2; A[d]: $3; B[d]: $4
12 P[d]: PerpTo(O[d],A[d],B[d])
13 if d > 0 then {
14 exec sprintf("drawperp(%g,P[%g],O[%g],A[%g]) with .O[%g] at P[%g]",\
15 d-1,d,d,d,d-1,d)
16 exec sprintf("drawperp(%g,P[%g],B[%g],O[%g]) with .O[%g] at P[%g]",\
17 d-1,d,d,d,d-1,d)
18 }
19 line outlined graystring((depth-d)/depth) from O[d] to P[d]
20 ] }
21
22 depth = 6
23 drawperp(depth,O,A,B) with .O[depth] at O
24 line from O to A then to B then to O
25
26 .PE