#! /bin/csh -f
# Last edited on 1999-01-31 07:41:45 by stolfi
set usage = "$0 INDIR OTDIR OFILE RFILE XFILE YFILE ZFILE"
# First, this script reads the five N-dimensional points OFILE RFILE
# XFILE YFILE ZFILE and computes three orthogonal vectors parallel to
# the affine space generated by RFILE XFILE YFILE ZFILE. These vectors
# are written out as OTDIR/{X,Y,Z}.dir. The point OFILE is also copied
# to OTDIR/O.pos
# Then the script reads all points INDIR/POINT.pos, for all POINTs
# listed in OTDIR/all.names. The script subtracts OTDIR/O.pos from
# each point, then projects the result onto each of the axes
# OTDIR/{X,Y,Z}.dir, storing their projections in files
# OTDIR/{X,Y,Z}.projs
#
# Finally, the script creates one colorized scatter plot with those
# points, for each pair of axes. The plots are written to
# OTDIR/X-Y.gif, OTDIR/X-Z.gif, and OTDIR/Y-Z.gif.
#
# For this script, a point or vector in N-space is a file with N
# entries of the form COORD LABEL, where COORD is a real number and
# LABEL any word. The LABELs must be sorted and must match across all
# point files.
set recompute = 1;
while ( ( $#argv > 0 ) && ( /$1 =~ /-* ) )
if ( ( $#argv > 0 ) && ( "/$1" == "/-dontRecompute" ) ) then
set recompute = 0; shift
else
echo "bad option"; echo "usage = ${usage}"; exit 1
endif
end
if ( $#argv != 7) then
echo "usage: ${usage}"; exit 1
endif
set tmp = "/tmp/$$"
set indir = "$1"; shift
set otdir = "$1"; shift
set oref = "$1"; shift
set rref = "$1"; shift
set xref = "$1"; shift
set yref = "$1"; shift
set zref = "$1"; shift
if ( $recompute ) then
echo "recomputing projections"
cp -p ${oref} ${otdir}/O.pos
choose-three-orthogonal-axes ${otdir} ${rref} ${xref} ${yref} ${zref}
foreach axis ( X Y Z )
/bin/rm ${otdir}/${axis}.projs
project-points \
${otdir}/O.pos \
${otdir}/${axis}.dir \
${indir} \
`cat ${otdir}/all.names` \
> ${otdir}/${axis}.projs
end
else
echo "reusing old projections"
endif
foreach fg ( X.Y X.Z Y.Z )
set f = ${fg:r}
set g = ${fg:e}
plot-page-data ${otdir} ${f} ${g} \
> ${otdir}/${f}-${g}.gif
xv ${otdir}/${f}-${g}.gif &
end