/*returns number of edges f1 and f2 share.*/
-int BM_Face_Sharededges(struct BMFace *f1, struct BMFace *f2);
+int BM_Face_Share_Edges(struct BMFace *f1, struct BMFace *f2);
/*returns number of faces e1 and e2 share.*/
int BM_Edge_Share_Faces(struct BMEdge *e1, struct BMEdge *e2);
+/*returns bool 1/0 if the edges share a vertex */
+int BM_Edge_Share_Vert(struct BMEdge *e1, struct BMEdge *e2);
+
/*edge verts in winding order from face*/
void BM_Edge_OrderedVerts(struct BMEdge *edge, struct BMVert **r_v1, struct BMVert **r_v2);
if(bmesh_radial_find_face( ((f2loop->prev))->e,f1)) return NULL;
/*validate only one shared edge*/
- shared = BM_Face_Sharededges(f1,f2);
+ shared = BM_Face_Share_Edges(f1,f2);
if(shared > 1) return NULL;
/*validate no internal joins*/
if(bmesh_radial_find_face(f2loop->prev->e,f1)) return NULL;
/*validate only one shared edge*/
- shared = BM_Face_Sharededges(f1,f2);
+ shared = BM_Face_Share_Edges(f1,f2);
if(shared > 1) return NULL;
/*validate no internal joins*/
* Integer
*/
-int BM_Face_Sharededges(BMFace *f1, BMFace *f2)
+int BM_Face_Share_Edges(BMFace *f1, BMFace *f2)
{
BMLoop *l;
int count = 0;
return 0;
}
+/**
+ *
+ * BMESH EDGE SHARE A VERTEX
+ *
+ * Tests to see if e1 shares a vertex with e2
+ *
+*/
+
+int BM_Edge_Share_Vert(struct BMEdge *e1, struct BMEdge *e2)
+{
+ return (e1->v1 == e2->v1 ||
+ e1->v1 == e2->v2 ||
+ e1->v2 == e2->v1 ||
+ e1->v2 == e2->v2);
+}
+
/**
*
* BMESH EDGE ORDERED VERTS
count++;
}
-#define EDGECON(e1, e2) (e1->v1 == e2->v1 || e1->v2 == e2->v2 || e1->v1 == e2->v2)
-
- if (edges1 && BLI_array_count(edges1) > 2 && EDGECON(edges1[0], edges1[BLI_array_count(edges1)-1])) {
- if (edges2 && BLI_array_count(edges2) > 2 && EDGECON(edges2[0], edges2[BLI_array_count(edges2)-1])) {
+ if (edges1 && BLI_array_count(edges1) > 2 && BM_Edge_Share_Vert(edges1[0], edges1[BLI_array_count(edges1)-1])) {
+ if (edges2 && BLI_array_count(edges2) > 2 && BM_Edge_Share_Vert(edges2[0], edges2[BLI_array_count(edges2)-1])) {
BLI_array_free(edges1);
BLI_array_free(edges2);
return;
}
}
- if (edges2 && BLI_array_count(edges2) > 2 && EDGECON(edges2[0], edges2[BLI_array_count(edges2)-1])) {
+ if (edges2 && BLI_array_count(edges2) > 2 && BM_Edge_Share_Vert(edges2[0], edges2[BLI_array_count(edges2)-1])) {
edges2 = NULL;
}
BLI_array_free(edges1);
BLI_array_free(edges2);
-
-#undef EDGECON
}
/*this is essentially new fkey*/
}
/*make sure the two edges have a valid angle to each other*/
- if (totesel == 2 && (e1->v1 == e2->v1 || e1->v1 == e2->v2
- || e1->v2 == e2->v1 || e1->v2 == e2->v1)) {
+ if (totesel == 2 && BM_Edge_Share_Vert(e1, e2)) {
float angle;
sub_v3_v3v3(vec1, e1->v2->co, e1->v1->co);
BM_ITER(e2, &iter2, bm, BM_EDGES_OF_VERT, v2) {
float angle;
- if (e1->v1 == e2->v1 || e1->v2 == e2->v2 || e1->v1 == e2->v2 || e1->v2 == e2->v1)
+ if (BM_Edge_Share_Vert(e1, e2)) {
continue;
+ }
sub_v3_v3v3(vec1, BM_OtherEdgeVert(e1, v1)->co, v1->co);
sub_v3_v3v3(vec2, BM_OtherEdgeVert(e2, v2)->co, v2->co);