# Rename file to "spiro2.gp" # usage: gnuplot < spiro2.gp ; xv spiro2.png # ###spiro2.gp gnuplot script to plot trochoids ###22aug07 from http://linuxgazette.net/133/luana.html # set terminal png set output "spiro2.png" set size ratio -1 set nokey set noxtics set noytics set noborder set parametric # x(t)=(R-r)*cos(t) + p*cos((R-r)*t/r) y(t)=(R-r)*sin(t) - p*sin((R-r)*t/r) # ### circle: p=0; ellipse: R=2r and p≠r, with axes (r+p) and |r-p|; ### R=2r=2p gives a line of length 2a; ### p=r; produces hypocycloids ### negative p and/or r results in some extraordinary specimens. # R=100.0; r=2.0; p=80.0 set samples 2001 # plot [t=0:2*pi] x(t), y(t)