diff options
-rw-r--r-- | source/blender/bmesh/intern/bmesh_queries.h | 1 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_connect_concave.c | 11 |
2 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/bmesh/intern/bmesh_queries.h b/source/blender/bmesh/intern/bmesh_queries.h index 535b752d4f2..abff55719f5 100644 --- a/source/blender/bmesh/intern/bmesh_queries.h +++ b/source/blender/bmesh/intern/bmesh_queries.h @@ -143,7 +143,6 @@ bool BM_face_is_any_vert_flag_test(const BMFace *f, const char hflag) ATTR_WARN_ bool BM_face_is_any_edge_flag_test(const BMFace *f, const char hflag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); bool BM_face_is_normal_valid(const BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); -bool BM_face_is_convex(const BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); float BM_mesh_calc_volume(BMesh *bm, bool is_signed) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); diff --git a/source/blender/bmesh/operators/bmo_connect_concave.c b/source/blender/bmesh/operators/bmo_connect_concave.c index aec8119d421..f6f0ed48534 100644 --- a/source/blender/bmesh/operators/bmo_connect_concave.c +++ b/source/blender/bmesh/operators/bmo_connect_concave.c @@ -22,6 +22,14 @@ * \ingroup bmesh * * Connect vertices so all resulting faces are convex. + * + * Implementation: + * + * - triangulate all concave face (tagging convex verts), + * - rotate edges (beautify) so edges will connect nearby verts. + * - sort long edges (longest first), + * put any edges between 2 convex verts last since they often split convex regions. + * - merge the sorted edges as long as they don't create convex ngons. */ #include "MEM_guardedalloc.h" @@ -56,11 +64,12 @@ static int bm_edge_length_cmp(const void *a_, const void *b_) else if (e_a_concave > e_b_concave) return 1; else { + /* otherwise shortest edges last */ const float e_a_len = BM_edge_calc_length_squared(e_a); const float e_b_len = BM_edge_calc_length_squared(e_b); if (e_a_len < e_b_len) return 1; else if (e_a_len > e_b_len) return -1; - else return 0; + else return 0; } } |