calculate different positions for layers