minor edits to last commit

This commit is contained in:
Campbell Barton
2015-02-02 19:19:52 +11:00
parent f12c17abfe
commit 8cd106f12a
2 changed files with 10 additions and 2 deletions

View File

@@ -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();

View File

@@ -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;
}
}