The Euler-Poincaré formula describes the relationship of the number of vertices, the number of edges and the number of faces of a manifold. It has been generalized to include potholes and holes that penetrate the solid. To state the Euler-Poincaré formula, we need the following definitions:
Part of the information recorded in a B-rep is topological (i.e., adjacency relations). Invalid solids may be generated if the representation is not carefully constructed. One way of checking this topological invalidity is to use the Euler-Poincaré formula. If its value is not zero, we are sure something must be wrong in the representation. However, this is only a one-side test. More precisely, a zero value of the Euler-Poincaré formula does not mean the solid is valid.
The figure above has a box and an additional sheet which is simply a rectangle. This object has 10 vertices, 15 edges, 7 faces, 1 shell and no hole. Its loop number is equal to the number of faces. The value of the Euler-Poincaré formula is zero as shown below,
but this is not a valid solid! Therefore, if the value of Euler-Poincaré formula is non-zero, the representation is definitely not a valid solid. However, the value of the Euler-Poincaré formula being zero does not guarantee the representation would yield a valid solid.
It is not always easy to count genus G correctly. For example, suppose we have a sphere punched by three tunnels as shown below. The left object shows the outside look. The right one shows the inside by cutting half of the sphere off. What is the genus value G? We know that the genus value counts the number of penetrating holes. But, in this example, it is somewhat ambiguous. In fact, by combining any two center-going tunnels we will have three penetrating holes. However, this is incorrect!
The Euler-Poincaré Formula describes the topological property amount vertices, edges, faces, loops, shells and genus. Any topological transformation applied to the model will not alter this relationship. Intuitively, applying topological transformations means we can twist, stretch and squash the model but we cannot cut some parts off nor glue some parts together. Let us apply some intuitive topological transformations to this model for computing the genus. We can push the "walls" surrounding the three tunnels so that the interior of the model becomes a thin shell. This is shown in the image below.
Stretch the top hole so that it is large enough (below left). Then, collapse the top portion to flatten the model. This is shown in the right model below. How many penetrating holes are there? Two! Therefore, G is 2.
Sometimes, penetrating holes may appear in an unlikely situation. Consider the following model which is obtained by taking out a torus and tube from the interior of a sphere. What is the genus of this model? It does not look like there is a penetrating hole. So, is genus equal to 0? In fact, G = 1! Figure it out yourself. Do some twisting, stretching and squashing.