Chamfer distances on the isometric grid: a structural description of minimal distances based on linear programming approach