modified densities in order to use any direction (x or y)