Skip to content

Instantly share code, notes, and snippets.

@ryuichiueda
Created April 4, 2014 14:24
Show Gist options
  • Save ryuichiueda/9975677 to your computer and use it in GitHub Desktop.
Save ryuichiueda/9975677 to your computer and use it in GitHub Desktop.
#!/bin/bash -xv
cat << FIN > /tmp/header
P2
600 600
255
FIN
###真っ黒な画###
seq -w 0 359999 > /tmp/body
yes |
awk -v "x=1" -v "y=2" -v "z=3"\
-v "p=10" -v "r=28" -v "b=2.666666" -v "dt=0.001" \
'{dx=(-p*x+p*y)*dt;dy=(-x*z+r*x-y)*dt;dz=(x*y-b*z)*dt;\
print x,y,z;x+=dx;y+=dy;z+=dz}' |
###画像の座標に変換###
awk '{print int($2*10)+300, int($1*10)+300}' |
###PGMのピクセルの順番に変換###
awk '{print $1+$2*600, 255}' |
head -n 50000 |
sort -u -k1,1n |
maezero 1.6 |
loopj num=1 /tmp/body - |
awk '{print $2}' |
cat /tmp/header - > /tmp/lorentz.pgm
convert /tmp/lorentz.pgm ./lorentz.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment