16
I have this function (converting coordinate of an WGS84 geoid to cartesian coordinates...doesn't matter):
function convert_geo_to_enu(coord_geo) { \
xi=sqrt(1 - e*e*sin(coord_geo[1])*sin(coord_geo[2])); \
\
coord_enu[1]=(a/xi + coord_geo[3])*cos(coord_geo[1])*cos(coord_geo[2]); \
print coord_enu[1] " hhh " ; \
coord_enu[2]=(a/xi + coord_geo[3])*cos(coord_geo[1])*sin(coord_geo[2]); \
coord_enu[3]=(a*(1-e*e)/xi0 + coord_geo[3])*sin(coord_geo[1]); \
\
return coord_enu \ # <-- here comes the problem
} \
problem --> mawk: line 64: illegal reference to array coord_enu
What is the problem to return as an array? Is there any different syntax?
I could use:
function convert_geo_to_enu(coord_geo, coord_enu) { \
...
coord_enu[1]=...
...
} \
or even:
function convert_geo_to_enu(coord_geo) { \
...
coord_enu[1]=...
...
} \
and then just use the variable coord_enu as a global?
But it looks better with usage of return statement (esp. for me)