diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-12-25 13:14:13 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-12-26 00:46:48 +0300 |
commit | 445e50fd1e7d41306ea475bd79bb89bc2d7fc3b1 (patch) | |
tree | eb5c1f2b6494a0cb8094fa5a64b5a374564fa935 /source/blender/bmesh/tools | |
parent | cd095aae139ecbcfdf2103f635eae8d5bc5f3b8e (diff) |
cleanup: use cross_tri_v2 when area isn't needed.
Diffstat (limited to 'source/blender/bmesh/tools')
-rw-r--r-- | source/blender/bmesh/tools/bmesh_beautify.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/source/blender/bmesh/tools/bmesh_beautify.c b/source/blender/bmesh/tools/bmesh_beautify.c index 1c6dc6f5c0e..6fb7f7cb4be 100644 --- a/source/blender/bmesh/tools/bmesh_beautify.c +++ b/source/blender/bmesh/tools/bmesh_beautify.c @@ -187,8 +187,8 @@ static float bm_edge_calc_rotate_beauty__area( * into a different degenerate shape or flipping the face */ float area_a, area_b; - area_a = area_tri_signed_v2(v1_xy, v2_xy, v3_xy); - area_b = area_tri_signed_v2(v1_xy, v3_xy, v4_xy); + area_a = cross_tri_v2(v1_xy, v2_xy, v3_xy); + area_b = cross_tri_v2(v1_xy, v3_xy, v4_xy); if ((fabsf(area_a) <= FLT_EPSILON) || (fabsf(area_b) <= FLT_EPSILON)) { /* one of the new rotations is degenerate */ @@ -219,16 +219,19 @@ static float bm_edge_calc_rotate_beauty__area( len_13 = len_v2v2(v1_xy, v3_xy); len_24 = len_v2v2(v2_xy, v4_xy); + /* note, area is in fact (area * 2), + * but in this case its OK, since we're comparing ratios */ + /* edge (2-4), current state */ - area_a = area_tri_v2(v2_xy, v3_xy, v4_xy); - area_b = area_tri_v2(v2_xy, v4_xy, v1_xy); + area_a = fabsf(cross_tri_v2(v2_xy, v3_xy, v4_xy)); + area_b = fabsf(cross_tri_v2(v2_xy, v4_xy, v1_xy)); prim_a = len_23 + len_34 + len_24; - prim_b = len_24 + len_41 + len_12; + prim_b = len_41 + len_12 + len_24; fac_24 = (area_a / prim_a) + (area_b / prim_b); /* edge (1-3), new state */ - area_a = area_tri_v2(v1_xy, v2_xy, v3_xy); - area_b = area_tri_v2(v1_xy, v3_xy, v4_xy); + area_a = fabsf(cross_tri_v2(v1_xy, v2_xy, v3_xy)); + area_b = fabsf(cross_tri_v2(v1_xy, v3_xy, v4_xy)); prim_a = len_12 + len_23 + len_13; prim_b = len_34 + len_41 + len_13; fac_13 = (area_a / prim_a) + (area_b / prim_b); |