In this work, an object-oriented geometric engine is proposed to solve problems with discontinuities, for instance, material interfaces and cracks, by means of unfitted, immersed, or enriched finite element methods (FEMs). Both explicit and implicit representations, such as geometric entities and level sets, are intro duced to describe configurations of discontinuities. The geometric engine is designed in an object-oriented way and consists of several modules. For effi ciency, a k-d tree data structure that partitions the background mesh is con structed for detecting cut elements whose neighbors are found by means of a dual graph structure. Moreover, the implementation for creating enriched nodes, integration elements, and physical groups is described in detail, and the corresponding pseudo-code is also provided. The complexity and efficiency of the geometric engine are investigated by solving 2-D and 3-D discontinu ous models. The capability of the geometric engine is demonstrated on several numerical examples. Topology optimization and problems with intersecting dis continuities are handled with enriched FEMs, where enriched discretizations obtained from the geometric engine are used for the analysis. Furthermore, polycrystalline structures that overlap with an unfitted mesh are considered, where integration elements are created so they align with grain boundaries. Another example shows that the Stanford bunny, which is discretized by a surface mesh with triangular elements, can be fully immersed into a 3-D back ground mesh. Finally, we share a list of main findings and conclude that the proposed geometric engine is general, robust, and efficient