Solder vertices
It is useful to weld two or more vertices (which may have errors) together. More accurately, only one remaining one is deleted. For example, to weld A and B in Figure 14.9, there are two steps:
(1) Step 1: scan the Triangle List and replace all references to B with references to.
(2) Step 2, B is now an isolated vertex, Which is deleted from the vertex list.
There are two purposes for welding vertices. First, remove duplicate vertices to save memory. This is an important optimization method, making grid operations (such as rendering and conversion) faster. Secondly, the adjacent edges in the ry are logically adjacent.
We have discussed the welding of two vertices. In practice, we often want to find all vertices adjacent to the welding point. This idea is very straightforward, but several details need to be clarified.
(1) isolated points should be removed before welding. We do not want any unused points to affect the points being used, as shown in Figure 14.10:
(2) When both vertices come from a "Slender" triangle, the welding may produce a degraded triangle, as shown in 14.11 (similar to the side contraction margin ). Such triangles should be deleted. Generally, the number of triangles is not large. Welding usually significantly reduces the number of vertices and removes a small part of the thin surface.
(3) When welding, it seems that the average of the original vertex should be used as the new vertex, rather than simply selecting one and dropping the other. This method is not biased towards any vertex. It seems to be a good idea when only a few vertices need to be welded. However, automatic welding may cause a "Domino" effect, resulting in welding of multiple points that are not within the error margin.
In Figure 14.12, points A and B should be welded within the error margin. We intelligently weld these two points and calculate the average values of A and B to get a new vertex D. Now C and D are soldered within the margin range, and finally e is generated. The result is that vertices A and C are soldered and they are not within the error margin. Moreover, our "smart" attempt fails because A, B, and C are soldered, but the result is not the average of the three points.
This is not the worst case. At least there is no point running out of the error margin. However, we can deliberately use more vertices and different sequences to create such vicious examples. Unfortunately, this problem exists in practice.ProgramAnd automatically generated programs. In fact, even if the new coordinates are not evenly generated, the above problems still exist. For example, we can solve this problem by applying a simple rule "always welding high-order vertices to low-order vertices" without considering the average coordinates.
There are some ways to prevent the above problems. For example, you can first find the vertex groups within all the error tolerance before welding them; or ignore the vertices that have been welded; or record the original vertex coordinates, vertices are not soldered when they are out of tolerance. These methods are too complex, so we should not increase complexity for less significant performance. Welding is to remove duplicate vertices, rather than to reduce the number of triangles in a grid: to minimize the number of triangles, and to keep the shape of the triangle as unchanged as possible. More advancedAlgorithm.
Another problem is the additional information about the tin, such as the surface method vector and texture ing coordinate. When the point is welded, the previous discontinuous disappears. Figure 14.8 is an example.
Finally, the direct implementation of vertex welding is very slow. Even in today's hardware conditions, it takes several seconds to weld thousands of points and surfaces. The algorithm for finding welding vertices is O (n2) complex. The replacement of the vertex index after a welding requires traversing the entire Triangle List; deleting a vertex also requires traversing the Triangle List to repair the index of vertices higher than the deletion of vertex numbers. Fortunately, to think about it, we can find a much faster algorithm.
Face splitting
Surface splitting refers to copying vertices so that the edges are no longer shared. It is the opposite of welding. Apparently, face splitting will lead to topology interruption because the face is no longer adjacent. This is our purpose, so that the topology of the geometric break is also broken (such as the angle and edge ). Figure 14.13 shows the split of two triangles. Although we separate the two triangles to show that there are multiple edges and vertices, this is only to show that the vertices are not moving, new vertices and edges overlap.
In practice, we often need to split all faces.
Scale down
Edges are used to reduce edges to vertices, which correspond to vertex splitting. As shown in figure 14.14, the two vertices of the edges are changed to one and the triangles that share the edges (the shadow part in Figure 14.14) disappear. Edges are often used for grid reduction because they reduce the number of vertices and triangles.
Grid reduction
Mesh reduction changes the mesh with a large number of triangles and vertices into a mesh with a relatively small number of triangles and vertices, and requires that the mesh appearance and main vertices remain unchanged as much as possible. Hugues consumer PE pointed out that Zhi only needs to scale down edges to achieve good results. It is time-consuming to select the edges to scale down, depending on the complexity of the heuristic method. Although it takes a long time to select a scale object, the scale-in operation is not complicated. We can record this process offline and "replay" it as needed in real time to get the style of any fine program. This paper describes how to use vertex splitting to reverse the process of scaling down edges. The mesh generated by this inversion method is called a progressive grid.
From: http://www.cppblog.com/lovedday/archive/2008/03/02/43570.html