66 |
|
set step=`ev "sqrt(($c11[1]-$c00[1])*($c11[1]-$c00[1])+($c11[2]-$c00[2])*($c11[2]-$c00[2]))/70"` |
67 |
|
endif |
68 |
|
set res=(`ev "ceil(sqrt(($c01[1]-$c00[1])*($c01[1]-$c00[1])+($c01[2]-$c00[2])*($c01[2]-$c00[2]))/$step)" "ceil(sqrt(($c10[1]-$c00[1])*($c10[1]-$c00[1])+($c10[2]-$c00[2])*($c10[2]-$c00[2]))/$step)"`) |
69 |
< |
cat > /tmp/edge$$.rad << _EOF_ |
69 |
> |
set edgef=`mktemp /tmp/edgerad.XXXXXX` |
70 |
> |
cat > $edgef << _EOF_ |
71 |
|
void sphere c00 |
72 |
|
0 0 4 |
73 |
|
$c00 .001 |
93 |
|
0 0 7 |
94 |
|
$c10 $c11 .001 |
95 |
|
_EOF_ |
96 |
< |
cat > /tmp/mesh$$.cal << _EOF_ |
96 |
> |
set meshcal=`mkdir /tmp/meshcal.XXXXXX` |
97 |
> |
cat > $meshcal << _EOF_ |
98 |
|
lerp(x,y0,y1):(1-x)*y0+x*y1; |
99 |
|
and(a,b):if(a,b,-1); |
100 |
|
or(a,b):if(a,1,b); |
122 |
|
lo=if(inmesh,1e10,if(wts-EPS,sum/wts,($lim[5]+$lim[6])/2)); |
123 |
|
_EOF_ |
124 |
|
# Generate height image |
125 |
< |
xform -m void $mesh | oconv - /tmp/edge$$.rad > /tmp/mesh$$.oct |
125 |
> |
set meshoct=`/tmp/meshoct.XXXXXXX` |
126 |
> |
xform -m void $mesh | oconv - $edgef > $meshoct |
127 |
> |
set meshpic=`mktemp /tmp/meshpic.XXXXXX` |
128 |
|
cnt $res[2] $res[1] \ |
129 |
|
| rcalc -e 'sp=$2/'"($res[1]-1)" -e 'tp=1-$1/'"($res[2]-1)" \ |
130 |
< |
-f /tmp/mesh$$.cal -e "xp=xpos(sp,tp);yp=ypos(sp,tp)" \ |
130 |
> |
-f $meshcal -e "xp=xpos(sp,tp);yp=ypos(sp,tp)" \ |
131 |
|
-e '$1=xp;$2=yp;$3=z0;$4=0;$5=0;$6=1' \ |
132 |
< |
| rtrace -w -faf -oL -x $res[1] -y $res[2] /tmp/mesh$$.oct \ |
133 |
< |
| pvalue -r -b -df > /tmp/mesh$$.pic |
134 |
< |
rm /tmp/edge$$.rad /tmp/mesh$$.oct |
132 |
> |
| rtrace -w -faf -oL -x $res[1] -y $res[2] $meshoct \ |
133 |
> |
| pvalue -r -b -df > $meshpic |
134 |
> |
rm $edgef $meshoct |
135 |
|
# Output mesh surround |
136 |
|
cat << _EOF_ |
137 |
|
# $0 $argv[*] |
141 |
|
# $c11 |
142 |
|
# $c10 |
143 |
|
_EOF_ |
144 |
< |
pflip -v /tmp/mesh$$.pic \ |
145 |
< |
| pcomb -f /tmp/mesh$$.cal - \ |
144 |
> |
pflip -v $meshpic \ |
145 |
> |
| pcomb -f $meshcal - \ |
146 |
|
| pvalue -h -H -pG -d \ |
147 |
|
| gensurf $mat $nam 'xpos(s,t)' 'ypos(s,t)' - \ |
148 |
|
`ev $res[1]-1 $res[2]-1` \ |
149 |
|
-e 'valid(xf,yf)=1e9-Z`SYS(xf,yf)' \ |
150 |
< |
-f /tmp/mesh$$.cal $smooth |
151 |
< |
rm /tmp/mesh$$.cal /tmp/mesh$$.pic |
150 |
> |
-f $meshcal $smooth |
151 |
> |
rm $meshcal $meshpic |
152 |
|
# All done -- exit |
153 |
|
exit 0 |
154 |
|
# Usage error message |