#!/usr/local/bin/perl # usage # extractDOF.pl [1|2|3] # where [1|2|3] is the DOF # e.g. # extractDOF.pl abc.Demo03.AMC lfoot 2 # # get command line argument $AMC = $ARGV[0]; $JOINT = $ARGV[1]; $DOF = $ARGV[2]; # reality check # print "AMC file: \"" . $AMC . "\"\n"; # open BVH file open (AMC,$AMC); if ($DOF == 1) { while ($_ = ) { # if (/^(\d+)/) { print "$1 " ;} if (/^$JOINT\s*(-?\d+(\.\d+|\b))/) { print $1 . "\n"; } } } if ($DOF == 2) { while ($_ = ) { # if (/^(\d+)/) { print "$1 " ;} if (/^$JOINT\s+(-?\d+(\.\d+|\b))\s+(-?\d+(\.\d+|\b))/) { print $3 . "\n"; } } } if ($DOF == 3) { while ($_ = ) { # if (/^(\d+)/) { print "$1 " ;} if (/^$JOINT\s+(-?\d+(\.\d+|\b))\s+(-?\d+(\.\d+|\b))\s+(-?\d+(\.\d+|\b))/) { print $5 . "\n"; } } }