add BM_edge_is_contiguous(), check for python api.

This commit is contained in:
Campbell Barton 2013-02-04 10:14:31 +00:00
parent 0515f933d9
commit 4528405597
3 changed files with 26 additions and 3 deletions

@ -762,6 +762,19 @@ int BM_edge_is_manifold(BMEdge *e)
}
#endif
/**
* Tests that the edge is manifold and
* that both its faces point the same way.
*/
bool BM_edge_is_contiguous(BMEdge *e)
{
const BMLoop *l = e->l;
const BMLoop *l_other = l->radial_next;
return (l && (l_other != l) && /* not 0 or 1 face users */
(l_other->radial_next == l) && /* 2 face users */
(l_other->v != l->v));
}
/**
* Tests whether or not an edge is on the boundary
* of a shell (has one face associated with it)

@ -61,6 +61,7 @@ bool BM_edge_is_wire(BMEdge *e);
bool BM_vert_is_manifold(BMVert *v);
bool BM_edge_is_manifold(BMEdge *e);
bool BM_edge_is_boundary(BMEdge *e);
bool BM_edge_is_contiguous(BMEdge *e);
bool BM_loop_is_convex(BMLoop *l);

@ -412,6 +412,14 @@ static PyObject *bpy_bmedge_is_manifold_get(BPy_BMEdge *self)
return PyBool_FromLong(BM_edge_is_manifold(self->e));
}
PyDoc_STRVAR(bpy_bmedge_is_contiguous_doc,
"True when this edge is manifold, between two faces with the same winding (read-only).\n\n:type: boolean"
);
static PyObject *bpy_bmedge_is_contiguous_get(BPy_BMEdge *self)
{
BPY_BM_CHECK_OBJ(self);
return PyBool_FromLong(BM_edge_is_contiguous(self->e));
}
PyDoc_STRVAR(bpy_bmedge_is_wire_doc,
"True when this edge is not connected to any faces (read-only).\n\n:type: boolean"
@ -679,6 +687,7 @@ static PyGetSetDef bpy_bmedge_getseters[] = {
/* readonly checks */
{(char *)"is_manifold", (getter)bpy_bmedge_is_manifold_get, (setter)NULL, (char *)bpy_bmedge_is_manifold_doc, NULL},
{(char *)"is_contiguous", (getter)bpy_bmedge_is_contiguous_get, (setter)NULL, (char *)bpy_bmedge_is_contiguous_doc, NULL},
{(char *)"is_wire", (getter)bpy_bmedge_is_wire_get, (setter)NULL, (char *)bpy_bmedge_is_wire_doc, NULL},
{(char *)"is_boundary", (getter)bpy_bmedge_is_boundary_get, (setter)NULL, (char *)bpy_bmedge_is_boundary_doc, NULL},
{(char *)"is_valid", (getter)bpy_bm_is_valid_get, (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},