File: PerpTo.m4

package info (click to toggle)
texlive-base 2024.20250309-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,058,192 kB
  • sloc: perl: 44,903; sh: 5,008; makefile: 4,278; javascript: 3,034; ruby: 2,428; tcl: 2,131; xml: 1,874; python: 1,385; pascal: 1,249; cpp: 549; awk: 512; lisp: 447; ansic: 103; sed: 8
file content (26 lines) | stat: -rw-r--r-- 657 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
.PS
# PerpTo.m4
# https://tex.stackexchange.com/questions/666411/repetitive-perpendiculars-in-a-right-angle-triangle
gen_init

  O: (0,0)
  A: (5,0)
  B: (0,3)

define drawperp { #( depth, O, A, B )
[ d = $1; O[d]: $2; A[d]: $3; B[d]: $4
  P[d]: PerpTo(O[d],A[d],B[d])
  if d > 0 then {
    exec sprintf("drawperp(%g,P[%g],O[%g],A[%g]) with .O[%g] at P[%g]",\
      d-1,d,d,d,d-1,d)
    exec sprintf("drawperp(%g,P[%g],B[%g],O[%g]) with .O[%g] at P[%g]",\
      d-1,d,d,d,d-1,d)
    }
  line outlined graystring((depth-d)/depth) from O[d] to P[d]
  ] }

  depth = 6
  drawperp(depth,O,A,B) with .O[depth] at O
  line from O to A then to B then to O
   
.PE