syimplified code definition for cartesian coordinates.
now it shouldwork in any dimension