We present three algorithms for robust and efficient geometric calculations in the context of immersed boundary method (IBM), including classification of mesh cells as inside/outside of a closed surface, projection of points onto a surface, and accurate calculation of the solid volume fraction field created by a closed surface overlapping with a background Cartesian mesh. The algorithms use the signed distance field (SDF) to represent the surface and remove the intersection tests, which are usually required by other algorithms developed before, no matter the surface is described in analytic or discrete form. The errors of the algorithms are analyzed. We also develop an approximate method on efficient SDF field calculation for complex geometries. We demonstrate how the algorithms can be implemented within the framework of IBM with a volume-average discrete-forcing scheme and applied to simulate fluid–structure interaction problems.