code cleanup: minor edits to bmesh_jfke(), move simple checks first.
This commit is contained in:
@@ -1594,13 +1594,13 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou
|
||||
* \par Examples:
|
||||
*
|
||||
* A B
|
||||
* ---------- ----------
|
||||
* +--------+ +--------+
|
||||
* | | | |
|
||||
* | f1 | | f1 |
|
||||
* v1========v2 = Ok! v1==V2==v3 == Wrong!
|
||||
* | f2 | | f2 |
|
||||
* | | | |
|
||||
* ---------- ----------
|
||||
* +--------+ +--------+
|
||||
*
|
||||
* In the example A, faces \a f1 and \a f2 are joined by a single edge,
|
||||
* and the euler can safely be used.
|
||||
@@ -1617,13 +1617,18 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou
|
||||
BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
|
||||
{
|
||||
BMLoop *l_iter, *f1loop = NULL, *f2loop = NULL;
|
||||
int newlen = 0, i, f1len = 0, f2len = 0, radlen = 0, edok, shared;
|
||||
int newlen = 0, i, f1len = 0, f2len = 0, edok;
|
||||
|
||||
/* can't join a face to itsel */
|
||||
/* can't join a face to itself */
|
||||
if (f1 == f2) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* validate that edge is 2-manifold edge */
|
||||
if (!BM_edge_is_manifold(e)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* verify that e is in both f1 and f2 */
|
||||
f1len = f1->len;
|
||||
f2len = f2->len;
|
||||
@@ -1633,12 +1638,6 @@ BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* validate that edge is 2-manifold edg */
|
||||
radlen = bmesh_radial_length(f1loop);
|
||||
if (radlen != 2) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* validate direction of f2's loop cycle is compatible */
|
||||
if (f1loop->v == f2loop->v) {
|
||||
@@ -1647,17 +1646,16 @@ BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
|
||||
|
||||
/* validate that for each face, each vertex has another edge in its disk cycle that is
|
||||
* not e, and not shared. */
|
||||
if ( bmesh_radial_face_find(f1loop->next->e, f2) ||
|
||||
bmesh_radial_face_find(f1loop->prev->e, f2) ||
|
||||
bmesh_radial_face_find(f2loop->next->e, f1) ||
|
||||
bmesh_radial_face_find(f2loop->prev->e, f1) )
|
||||
if (bmesh_radial_face_find(f1loop->next->e, f2) ||
|
||||
bmesh_radial_face_find(f1loop->prev->e, f2) ||
|
||||
bmesh_radial_face_find(f2loop->next->e, f1) ||
|
||||
bmesh_radial_face_find(f2loop->prev->e, f1) )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* validate only one shared edg */
|
||||
shared = BM_face_share_edge_count(f1, f2);
|
||||
if (shared > 1) {
|
||||
/* validate only one shared edge */
|
||||
if (BM_face_share_edge_count(f1, f2) > 1) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1697,7 +1695,7 @@ BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
|
||||
/* increase length of f1 */
|
||||
f1->len += (f2->len - 2);
|
||||
|
||||
/* make sure each loop points to the proper fac */
|
||||
/* make sure each loop points to the proper face */
|
||||
newlen = f1->len;
|
||||
for (i = 0, l_iter = BM_FACE_FIRST_LOOP(f1); i < newlen; i++, l_iter = l_iter->next)
|
||||
l_iter->f = f1;
|
||||
|
||||
Reference in New Issue
Block a user