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