1# A generic rotation routine for the gnuplot demos. In the commands 2# that load this file, the following should be defined: 3# 4# iteration_count: set iteration_count=0 5# 6# iteration_delay: pause between frames of iteration (defaults to 0.1 sec) 7# 8# limit_iterations: if set to a nonzero value, it'll stop after that 9# many iterations; if zero value, continues indefinitely 10# 11# xrot: the initial x rotation of the view 12# 13# xrot_delta: the amount to increment the x rotation for each new plot 14# 15# xview: function for generating x view value; for example 16# xview(xrot)=(50.+30.*sin((xrot%180)/180.*pi)) 17# 18# zrot: the initial z rotation of the view 19# 20# zrot_delta: the amount to increment the z rotation for each new plot 21# 22# zview: function for generating z view value; for example 23# zview(zrot)=(60.+45.*sin(zrot/180.*pi)) 24# 25# History: 26# - 1. 1. 2006 Dan Sebald: Made more generic so other demos could use 27# - ?. ?. ? Hans-Bernhard Broeker: Used to just turn round and round 28# by somewhat large steps. Now, it tumbles back and forth 29# smoothly. 30# - ?. ?. ? ?: Initial recursive script 31# Nov 2017 Switch to version 5 iteration syntax rather than reread 32# Add timed pause 33 34if (!(exists("iteration_delay"))) iteration_delay = 0.1 35 36while ((!limit_iterations) || (iteration_count<=limit_iterations)) { 37 set view xview(xrot), zview(zrot) 38 replot 39 zrot = (zrot+zrot_delta) % 360 40 xrot = (xrot+xrot_delta) % 360 41 iteration_count = iteration_count + 1 42 pause iteration_delay 43} 44