Skip to content

Instantly share code, notes, and snippets.

@nicholasbishop
Created March 28, 2012 21:03
Show Gist options
  • Save nicholasbishop/2230482 to your computer and use it in GitHub Desktop.
Save nicholasbishop/2230482 to your computer and use it in GitHub Desktop.
bmesh_print
void bmesh_print(BMesh *bm)
{
BMIter iter, siter;
BMVert *v;
BMEdge *e;
BMFace *f;
fprintf(stderr, "\nbm=%p, totvert=%d, totedge=%d, "
"totloop=%d, totface=%d\n",
bm, bm->totvert, bm->totedge,
bm->totloop, bm->totface);
fprintf(stderr, "vertices:\n");
BM_ITER_MESH(v, &iter, bm, BM_VERTS_OF_MESH) {
fprintf(stderr, " %p co=(%.3f %.3f %.3f) index=%d\n",
v, v->co[0], v->co[1], v->co[2],
v->head.index);
}
fprintf(stderr, "edges:\n");
BM_ITER_MESH(e, &iter, bm, BM_EDGES_OF_MESH) {
fprintf(stderr, " %p v1=%p, v2=%p, index=%d\n",
e, e->v1, e->v2,
e->head.index);
}
fprintf(stderr, "faces:\n");
BM_ITER_MESH(f, &iter, bm, BM_FACES_OF_MESH) {
fprintf(stderr, " %p len=%d, index=%d\n",
f, f->len,
f->head.index);
fprintf(stderr, " v: ");
BM_ITER_ELEM(v, &siter, f, BM_VERTS_OF_FACE) {
fprintf(stderr, "%p ", v);
}
fprintf(stderr, "\n");
fprintf(stderr, " e: ");
BM_ITER_ELEM(e, &siter, f, BM_EDGES_OF_FACE) {
fprintf(stderr, "%p ", e);
}
fprintf(stderr, "\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment