*! version 1.0.0 , feb 98, Guy van Melle STB-45 gr30 *! *! function which reconsructs a surface analyzed by *! - has the appropriate 'hlfunc' form for use with or *! - requires matrices hlXcut, hlYcut, hlZfun as produced by makfun *! *! ex. of call: hidlin makfun, ... *! * *---------------- prog def hlmakfun *---------------- * version 5.0 loc x `1' loc y `2' loc z `3' capt confirm var `z' if _rc { qui g `z'=.} mac shift 3 loc in "opt" parse "`*'" loc rx = rowsof(hlZfun) loc ry = colsof(hlZfun) tempvar ifx ify qui{ g `ifx'=. g `ify'=. loc ix 0 while `ix'<`rx' { loc ix=`ix'+1 if `ix'==1 { replace `ifx'=`x'<=hlXcut[1,1] } else if `ix'==`rx' { replace `ifx'=`x'> hlXcut[`ix'-1,1] } else { replace `ifx'=`x'<=hlXcut[`ix',1] & `x'>hlXcut[`ix'-1,1] } loc iy 0 while `iy'<`ry'{ loc iy=`iy'+1 if `iy'==1 { replace `ify'=`y'<=hlYcut[1,1] } else if `iy'==`ry' { replace `ify'=`y'> hlYcut[`iy'-1,1] } else { replace `ify'=`y'<=hlYcut[`iy',1] & `y'>hlYcut[`iy'-1,1] } qui replace `z'=hlZfun[`ix',`iy'] `in' if `ifx' & `ify' } } } end *