File: RandomNodes.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 (19 lines) | stat: -rw-r--r-- 410 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
.PS
# RandomNodes.m4
gen_init
NeedDpicTools

  scale = 2.54
  n = 300
  msiz = 4.90*2
  maxdist = 1.0

  box wid msiz ht msiz with .sw at (0,0)
  for i=1 to n do { X[i] : (rand(), rand())*msiz }
  for i=1 to n-1 do { for j=i+1 to n do {
    if distance(X[i],X[j]) <= maxdist then { 
      line outlined "green" from X[i] to X[j]
      } } }
  for i=1 to n do { circle rad dotrad_ at X[i] shaded "green" }

.PE