diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-02-29 02:52:09 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-02-29 02:52:09 +0400 |
commit | e6ca57b9294ed71fc6fd2bf773a4c5ebc8760f97 (patch) | |
tree | 9b6bfd48b949835b41443cfb9b51cb1b81db282b /source/blender/bmesh | |
parent | 132544dd021f7a9a4e4b5190e027a78e8d8f074f (diff) |
fix [#30367] Face Fills Crossed
when making a quad from 2 edges - it was comparing the edge lengths to avoid making a bowtie quad. but this doesnt work in all cases, now compare normals instead.
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r-- | source/blender/bmesh/operators/bmo_create.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index 1a65db0e808..267d3d70a45 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -1173,6 +1173,8 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op) /* two unconnected loops, connect the */ if (edges1 && edges2) { BMVert *v1, *v2, *v3, *v4; + float dvec1[3]; + float dvec2[3]; if (BLI_array_count(edges1) == 1) { v1 = edges1[0]->v1; @@ -1204,10 +1206,22 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op) else v4 = edges2[i]->v1; } - /* avoid sqrt for comparison */ - if (len_squared_v3v3(v1->co, v3->co) + len_squared_v3v3(v2->co, v4->co) > - len_squared_v3v3(v1->co, v4->co) + len_squared_v3v3(v2->co, v3->co)) + /* if there is ever bowtie quads between two edges the problem is here! [#] */ +#if 0 + normal_tri_v3(dvec1, v1->co, v2->co, v4->co); + normal_tri_v3(dvec2, v1->co, v4->co, v3->co); +#else { + /* save some CPU cycles and skip the sqrt and 1 subtraction */ + float a1[3], a2[3], a3[3]; + sub_v3_v3v3(a1, v1->co, v2->co); + sub_v3_v3v3(a2, v1->co, v4->co); + sub_v3_v3v3(a3, v1->co, v3->co); + cross_v3_v3v3(dvec1, a1, a2); + cross_v3_v3v3(dvec2, a2, a3); + } +#endif + if (dot_v3v3(dvec1, dvec2) < 0.0f) { BMVert *v; v = v3; v3 = v4; |