added functions to compute cartesian positions