Subversion Repositories gelsvn

Rev

Rev 104 | Rev 115 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 104 Rev 113
Line 98... Line 98...
98
 
98
 
99
			}
99
			}
100
	}
100
	}
101
 
101
 
102
	bool Manifold::collapse_precond(VertexIter v1, HalfEdgeIter h)
102
	bool Manifold::collapse_precond(VertexIter v1, HalfEdgeIter h)
103
	{
-
 
104
		/* The goal of this (fiendishly complex) function is to test
-
 
105
			 whether an edge is collapsible. The test is as follows.
-
 
106
 
-
 
107
			 1. For the two vertices adjacent to the edge, we generate
-
 
108
			 a list of all their neighbouring vertices. We then generate a 
-
 
109
			 list of the vertices that occur in both these lists. That is, 
-
 
110
			 we find all vertices connected by edges to both endpoints
-
 
111
			 of the edge and store these in a list.
-
 
112
 
-
 
113
			 2. For both faces incident on the edge, check whether they
-
 
114
			 are triangular. If this is the case, the face will be removed,
-
 
115
			 and it is ok that the the third vertex is connected to both 
-
 
116
			 endpoints. Thus the third vertex in such a face is removed
-
 
117
			 from the list generated in 1.
-
 
118
 
-
 
119
			 3. If the list is now empty, all is well. Otherwise, there
-
 
120
			 would be a vertex in the new mesh with two edges connecting
-
 
121
			 it to the same vertex. Return false.
-
 
122
 
-
 
123
			 4. TETRAHEDRON TEST:
-
 
124
			 If the valency of both vertices is 
-
 
125
			 three, and the incident faces are triangles, we also disallow
-
 
126
			 the operation. Reason: It introduces a vertex of valency two
-
 
127
			 and if the final two polygons incident on the vertices 
-
 
128
			 that are adjacent to the edge being collapsed are triangles, then
-
 
129
			 the construction will collapse
-
 
130
 
-
 
131
			 5. VALENCY 4 TEST:
-
 
132
			 If a face adjacent to the edge being collapsed is a triangle,
-
 
133
			 it will disappear, and the valency of the final vertex beloning to
-
 
134
			 this edge will be reduced by one. Hence this valency should be at
-
 
135
			 least 4. A valency three vertex will be reduced to a valency two
-
 
136
			 vertex which is considered illegal.
-
 
137
 
-
 
138
			 6. PREVENT MERGING HOLES:
-
 
139
			 We do not want to collapse an edge if its end points are boundary
-
 
140
			 vertices, but its two adjacent faces are not NULL faces, because
-
 
141
			 in that case we create a vertex where two holes meet. A non manifold
-
 
142
			 situation.
-
 
143
			 
103
	{			
144
		*/
-
 
145
			
-
 
146
		VertexIter v2 = h->vert;
104
		VertexIter v2 = h->vert;
147
 
105
 
148
		std::vector<int> link1;
106
		std::vector<int> link1;
149
		VertexCirculator vc1(v1);
107
		VertexCirculator vc1(v1);
150
		for(;!vc1.end();++vc1)
108
		for(;!vc1.end();++vc1)