# Contour closeness

"One could say that the single biggest problem with CAD is that graphics cards are so powerful that they create a misleading interpretation of the actual underlying geometric data. The graphics serve to realize the user's design intent as a filtered image from the CAD model that may or may not actually exist in the surface data; most often not. As a result, many CAD users have an imprecise understanding of what is actually being modeled, closer to that of the graphics and farther from the true surface geometry, leading to user frustration in building analysis-suitable models." [Urick and Marussig, 2017]

The visualization engine of Analysis Situs is designed to be tolerant to possible anomalies in the CAD model definition. Since the number of possible geometric flaws in boundary representation is literally countless, it is important to cope with them, and, whenever reasonable, to draw the user's attention to the detected problems. According to [Requicha, 1980], a mathematical model of a rigid solid body is a bounded, closed, regular, semianalythic subset of a three-dimensional space. Such an abstract entity is called an "r-set." This definition has become a commonly accepted mathematical formalism in the field of engineering geometric modeling. Therefore, one of the basic requirements for a rigid solid is closeness. In the boundary representation scheme, closeness of a body can be seen at different levels.

- At the level of a solid body (in 3D), closeness means no missing faces (i.e., no "naked" edges).
- At the level of a single face (in 2D), closeness means no gaps in its contour.

Both properties are checked automatically on CAD model import. The shaded visualization of a model starts with preparation of facets, i.e., the triangles to be passed to the graphics device for rendering. However, if Analysis Situs finds that some face is not closed, it does not attempt to draw its facets. Instead, the host surface is visualized with isoparametric lines.

The closeness check is done in the parametric domain (UV space) of each face. In the parametric space, according to the Jordan theorem [Hales, 2007], a closed curve separates the plane into a bounded interior region and an unbounded exterior. However, the boundary of a region is usually not a single curve but the composition of curves which imperfectly touch each other at their end points. The coincidence test for the end points is done using the local tolerances of the face.