diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_mesh.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 12 |
2 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index c168c39fd9f..7abec074647 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -111,6 +111,10 @@ int poly_find_loop_from_vert(const struct MPoly *poly, int poly_get_adj_loops_from_vert(unsigned adj_r[3], const struct MPoly *poly, const struct MLoop *mloop, unsigned vert); +/* Return the index of the edge vert that is not equal to 'v'. If + * neither edge vertex is equal to 'v', returns -1. */ +int BKE_mesh_edge_other_vert(const struct MEdge *e, int v); + /* update the hide flag for edges and polys from the corresponding * flag in verts */ void BKE_mesh_flush_hidden_from_verts(const struct MVert *mvert, diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index a89cb042884..9eb74986b29 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -2996,6 +2996,18 @@ int poly_get_adj_loops_from_vert(unsigned adj_r[3], const MPoly *poly, return corner; } +/* Return the index of the edge vert that is not equal to 'v'. If + * neither edge vertex is equal to 'v', returns -1. */ +int BKE_mesh_edge_other_vert(const MEdge *e, int v) +{ + if (e->v1 == v) + return e->v2; + else if (e->v2 == v) + return e->v1; + else + return -1; +} + /* update the hide flag for edges and faces from the corresponding * flag in verts */ void BKE_mesh_flush_hidden_from_verts(const MVert *mvert, |