Boundary calculation