Skip to content

Commit

Permalink
add sandbox dir with a metaball demo animation script
Browse files Browse the repository at this point in the history
sandbox dir is intended to be a space for unmanaged uninstalled demonstration scripts.  ideally helpful snippets that show how to create geometry, chain commands together, achieve some interesting result without the overhead of docs.  sort of like proc-db but higher-level cli demos.
  • Loading branch information
brlcad committed May 11, 2022
1 parent b22b679 commit 5ce1ec5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions sh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ set(noinst_SCRIPTS
news2tracker.sh
template.sh
ws.sh
sandbox/metaring.sh
)
CMAKEFILES(${sh_SCRIPTS})
CMAKEFILES(${noinst_SCRIPTS})
Expand Down
18 changes: 18 additions & 0 deletions sh/sandbox/metaring.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

# set up a half-torus ring
echo " put tor tor V {0 0 0} H {1 0 0} r_a 400 r_h 100 ;
put sph ell V {0 400 0} A {100 0 0} B {0 100 0} C {0 0 100} ;
put sph2 ell V {0 -400 0} A {100 0 0} B {0 100 0} C {0 0 100} ;
in cut rpp -101 101 -501 501 -501 0 ;
r ring.r u tor - cut u sph u sph2 ;" | mged -c metaring.g

# create metaballs at all positions
for i in `seq 0 5 350` ; do c=`echo "scale=10; c($i * 4*a(1) / 180) * 400" | bc -l` ; s=`echo "scale=10; s($i * 4*a(1) / 180) * 400" | bc -l` ; echo "kill metaball`printf %03d $i` ; in metaball`printf %03d $i` metaball 0 1 3 0 400 0 100 0 -400 0 100 0 $c $s 100" ; done | mged -c metaring.g

# render image frames
for i in `seq 0 5 350` ; do echo $i ; rm -f m`printf %03d $i`.png ; rt -o m`printf %03d $i`.png -c "viewsize 1200" -c "orientation .5 .5 .5 .5" -c "eye_pt 5000 0 0" metaring.g metaball`printf %03d $i` ring.r 2>/dev/null ; done

# convert frames to animation
convert *.png anim.gif

0 comments on commit 5ce1ec5

Please sign in to comment.