orig/markpath.csh
author Axel Jacobs <axel@jaloxa.eu>
Mon, 14 Apr 2014 22:21:17 +0100
changeset 73 87fa3132a136
parent 0 0aa115157c9c
permissions -rw-r--r--
New IES test file with spaces in file name
     1 #!/bin/csh -f
     2 # RCSid: $Id: markpath.csh,v 2.2 2004/01/01 19:44:07 greg Exp $
     3 #
     4 # Put right trianglar markers down a path at the given intervals.
     5 # Use with replmarks to place regular-sized objects along a path.
     6 # Shorter (y-side) of triangles is always horizontal (perp. to z).
     7 #
     8 # Input is an ordered list of 3-D points defining the path.
     9 # We interpolate the path and align our markers with it.
    10 # Triangles are sized and aligned so tip of one meets butt of next
    11 #
    12 if ($#argv < 2) then
    13 	echo "Usage: $0 3d.pts spacing [markmat]"
    14 	exit 1
    15 endif
    16 set pts=$1
    17 set step=$2
    18 set mat=mark
    19 if ($#argv > 2) set mat=$3
    20 set npts=`wc -l < $pts`
    21 (head -1 $pts ; cat $pts) | rlam - $pts \
    22 	| rcalc -e '$1=d($1,$2,$3,$4,$5,$6)' -e "cond=$npts+.5-recno" \
    23 	-e 's(x):x*x;d(x0,y0,z0,x1,y1,z1):sqrt(s(x1-x0)+s(y1-y0)+s(z1-z0))' \
    24 	| total -1 -r > /tmp/run$$.dat
    25 rlam /tmp/run$$.dat $pts | tabfunc -i xp yp zp > /tmp/path$$.cal
    26 set tmax=`tail -1 /tmp/run$$.dat`
    27 set nsteps=`ev "floor($tmax/$step)"`
    28 echo $mat > /tmp/tri$$.fmt
    29 cat >> /tmp/tri$$.fmt << '_EOF_'
    30 polygon marker.${recno}
    31 0
    32 0
    33 9
    34 	${   x0    } ${   y0    } ${   z0   }
    35 	${   x1    } ${   y1    } ${   z1   }
    36 	${   x2    } ${   y2    } ${   z2   }
    37 
    38 '_EOF_'
    39 cnt $nsteps | rcalc -o /tmp/tri$$.fmt -f /tmp/path$$.cal -e st=$step \
    40 	-e 't=$1*st;x0=xp(t);y0=yp(t);z0=zp(t)' \
    41 	-e 'x1=xp(t+st);y1=yp(t+st);z1=zp(t+st)' \
    42 	-e 'x2=x0+.5*(y0-y1);y2=y0+.5*(x1-x0);z2=z0'
    43 rm /tmp/run$$.dat /tmp/path$$.cal /tmp/tri$$.fmt