Subversion Repositories gelsvn

Rev

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

Rev 89 Rev 113
Line 131... Line 131...
131
		FaceIter faces_begin() { return face_db.begin();	}
131
		FaceIter faces_begin() { return face_db.begin();	}
132
 
132
 
133
		/// Return iterator pointing to beyond the last face.
133
		/// Return iterator pointing to beyond the last face.
134
		FaceIter faces_end() { return face_db.end(); }
134
		FaceIter faces_end() { return face_db.end(); }
135
 
135
 
136
		/** HalfEdge collapse precondition. 
136
		/** \brief HalfEdge collapse precondition. 
-
 
137
 
137
				If this function does not return true, it is illegal to collapse
138
				If this function does not return true, it is illegal to collapse
138
				the halfedge given as second arg. The reason is that the collapse
139
				the halfedge given as second arg. The reason is that the collapse
139
				would violate the manifold property of the mesh. */
140
				would violate the manifold property of the mesh.
-
 
141
 
-
 
142
				The test is as follows.
-
 
143
 
-
 
144
				1. For the two vertices adjacent to the edge, we generate
-
 
145
				a list of all their neighbouring vertices. We then generate a 
-
 
146
				list of the vertices that occur in both these lists. That is, 
-
 
147
				we find all vertices connected by edges to both endpoints
-
 
148
				of the edge and store these in a list.
-
 
149
 
-
 
150
				2. For both faces incident on the edge, check whether they
-
 
151
				are triangular. If this is the case, the face will be removed,
-
 
152
				and it is ok that the the third vertex is connected to both 
-
 
153
				endpoints. Thus the third vertex in such a face is removed
-
 
154
				from the list generated in 1.
-
 
155
 
-
 
156
				3. If the list is now empty, all is well. Otherwise, there
-
 
157
				would be a vertex in the new mesh with two edges connecting
-
 
158
				it to the same vertex. Return false.
-
 
159
 
-
 
160
				4. TETRAHEDRON TEST:
-
 
161
				If the valency of both vertices is 
-
 
162
				three, and the incident faces are triangles, we also disallow
-
 
163
				the operation. Reason: It introduces a vertex of valency two
-
 
164
				and if the final two polygons incident on the vertices 
-
 
165
				that are adjacent to the edge being collapsed are triangles, then
-
 
166
				the construction will collapse
-
 
167
 
-
 
168
				5. VALENCY 4 TEST:
-
 
169
				If a face adjacent to the edge being collapsed is a triangle,
-
 
170
				it will disappear, and the valency of the final vertex beloning to
-
 
171
				this edge will be reduced by one. Hence this valency should be at
-
 
172
				least 4. A valency three vertex will be reduced to a valency two
-
 
173
				vertex which is considered illegal.
-
 
174
 
-
 
175
				6. PREVENT MERGING HOLES:
-
 
176
				We do not want to collapse an edge if its end points are boundary
-
 
177
				vertices, but its two adjacent faces are not NULL faces, because
-
 
178
				in that case we create a vertex where two holes meet. A non manifold
-
 
179
				situation.	*/
140
		bool collapse_precond(VertexIter, HalfEdgeIter);
180
		bool collapse_precond(VertexIter, HalfEdgeIter);
141
		
181
		
142
		/** Collapse the halfedge given as second argument. The first argument
182
		/** Collapse the halfedge given as second argument. 
-
 
183
 
-
 
184
		The first argument
143
				is the vertex that is being removed. This function is not guaranteed
185
				is the vertex that is being removed. The second is a halfedge pointing
-
 
186
				away from that vertex. This function is not guaranteed
144
				to keep the mesh sane unless, collapse_precond has returned true. */
187
				to keep the mesh sane unless, collapse_precond has returned true. */
145
		void collapse_halfedge(VertexIter, HalfEdgeIter, bool=false);
188
		void collapse_halfedge(VertexIter, HalfEdgeIter, bool=false);
146
 
189
 
147
		/** Split a face (first argument) by connecting two vertices (the
190
		/** Split a face (first argument) by connecting two vertices (the
148
				next two arguments). */
191
				next two arguments). */