diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-12-14 16:18:23 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-12-14 16:25:28 +0400 |
commit | ab9fabdfc61232a33648dbd3a11790f2dc46c75c (patch) | |
tree | c3777e06cb7d3a5acd9a3fbd720f8fb0fb353716 /source | |
parent | b43ce8a1403c66aac4736cbdf724554599b98579 (diff) |
BMesh API: optionally pass fallback to BM_edge_calc_face_angle functions
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_queries.c | 16 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_queries.h | 2 |
2 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c index e5acd19f927..c655fe4cc20 100644 --- a/source/blender/bmesh/intern/bmesh_queries.c +++ b/source/blender/bmesh/intern/bmesh_queries.c @@ -1202,7 +1202,7 @@ void BM_loop_calc_face_tangent(BMLoop *l, float r_tangent[3]) * * \return angle in radians */ -float BM_edge_calc_face_angle(const BMEdge *e) +float BM_edge_calc_face_angle_ex(const BMEdge *e, const float fallback) { if (BM_edge_is_manifold(e)) { const BMLoop *l1 = e->l; @@ -1210,9 +1210,13 @@ float BM_edge_calc_face_angle(const BMEdge *e) return angle_normalized_v3v3(l1->f->no, l2->f->no); } else { - return DEG2RADF(90.0f); + return fallback; } } +float BM_edge_calc_face_angle(const BMEdge *e) +{ + return BM_edge_calc_face_angle_ex(e, DEG2RADF(90.0f)); +} /** * \brief BMESH EDGE/FACE ANGLE @@ -1222,7 +1226,7 @@ float BM_edge_calc_face_angle(const BMEdge *e) * * \return angle in radians */ -float BM_edge_calc_face_angle_signed(const BMEdge *e) +float BM_edge_calc_face_angle_signed_ex(const BMEdge *e, const float fallback) { if (BM_edge_is_manifold(e)) { BMLoop *l1 = e->l; @@ -1231,9 +1235,13 @@ float BM_edge_calc_face_angle_signed(const BMEdge *e) return BM_edge_is_convex(e) ? angle : -angle; } else { - return DEG2RADF(90.0f); + return fallback; } } +float BM_edge_calc_face_angle_signed(const BMEdge *e) +{ + return BM_edge_calc_face_angle_signed_ex(e, DEG2RADF(90.0f)); +} /** * \brief BMESH EDGE/FACE TANGENT diff --git a/source/blender/bmesh/intern/bmesh_queries.h b/source/blender/bmesh/intern/bmesh_queries.h index a057d120be1..ab20b1c98ab 100644 --- a/source/blender/bmesh/intern/bmesh_queries.h +++ b/source/blender/bmesh/intern/bmesh_queries.h @@ -73,7 +73,9 @@ void BM_loop_calc_face_normal(BMLoop *l, float r_normal[3]); void BM_loop_calc_face_direction(BMLoop *l, float r_normal[3]); void BM_loop_calc_face_tangent(BMLoop *l, float r_tangent[3]); +float BM_edge_calc_face_angle_ex(const BMEdge *e, const float fallback); float BM_edge_calc_face_angle(const BMEdge *e); +float BM_edge_calc_face_angle_signed_ex(const BMEdge *e, const float fallback); float BM_edge_calc_face_angle_signed(const BMEdge *e); void BM_edge_calc_face_tangent(const BMEdge *e, const BMLoop *e_loop, float r_tangent[3]); |