2D and 3D visibility in discrete geometry: an application to discrete geodesic paths