Distortion-free tolerance-based layer setup optimization for layered manufacturing