#!/usr/bin/perl # # perl where2wf.pl wherefile wffile # # wherefile is a file with the output of several where statements # from partiview, and possibly other statements too. # # wffile is a .wf file with rows x y z rx ry rz timestep that can be used # to do the flypath later. It's equivalent to wherefile. if (($#ARGV < 1) | ($#ARGV > 2)) { print " Usage: perl where2wf.pl wherefile wffile [fov] wherefile is a file with the output of several where statements from partiview, and possibly other statements too. wffile is a .wf file with rows x y z rx ry rz that can be used to do the same flypath later. wffile_jump and wffile_jump_snapshot (neither with .wf extensions, and both executable) are also generated. If called with async from partiview, they go through the path, more slowly perhaps, and taking snapshots in the second case. " ; exit; } $wherefile = $ARGV[0]; $wffile = $ARGV[1]; $wffile_noext = $wffile; $wffile_noext =~s/\.wf//g; $wfjump = $wffile_noext; $wfsnap = $wffile_noext."_snap"; if ($wffile eq $wffile_noext) { $wffile = $wffile_noext.".wf"; } $fov=0; if ($#ARGV>1) {$fov=$ARGV[2];} open (WHERE,$wherefile); open (WF,">$wffile"); open (JUMP,">$wfjump"); open (SNAP,">$wfsnap"); printf JUMP "#!/bin/csh -f\n\n"; printf SNAP "#!/bin/csh -f\n\n"; $TIMESTEP = 60; $i = 0; while ($line = ) { if ($line =~ jump) { ($jumpstatement, $x,$y,$z,$rx,$ry,$rz,$a) = split /\s+/, $line; printf WF "%0.10f %0.10f %0.10f %0.10f %0.10f %0.10f %d\n", $x,$y,$z,$rx,$ry,$rz, $TIMESTEP; printf JUMP "echo jump %0.10f %0.10f %0.10f %0.10f %0.10f %0.10f %0.3f\n", $x,$y,$z,$rx,$ry,$rz, $a; printf JUMP "echo update\n"; printf SNAP "echo jump %0.10f %0.10f %0.10f %0.10f %0.10f %0.10f %0.3f\n", $x,$y,$z,$rx,$ry,$rz, $a; printf SNAP "echo step %0.4f\n", $i; if ($fov > 0) {printf SNAP "echo fov $fov\n";} printf SNAP "echo update\n"; printf SNAP "echo snapshot\n"; $i = $i + 0.0001; } } close (WHERE); close (WF); close (JUMP); close (SNAP); system ("chmod 755 $wfjump"); system ("chmod 755 $wfsnap");