diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-05-11 18:40:03 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-05-11 18:40:03 +0400 |
commit | 55f929ab3d01eb885904e37eee8fbb254fe53d1c (patch) | |
tree | 59df44462bbd8cf37ded302b71feeea45a6dae64 /source/blender/bmesh/intern/bmesh_edgeloop.h | |
parent | 309db8032c014e3915736482bc2689199d116cc7 (diff) |
- add generic edge-loop utility functions for bmesh.
- rewrite bridge tool to use the new functions (using edge & vertex arrays was quite cumbersome).
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_edgeloop.h')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_edgeloop.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_edgeloop.h b/source/blender/bmesh/intern/bmesh_edgeloop.h new file mode 100644 index 00000000000..06a457c3dd6 --- /dev/null +++ b/source/blender/bmesh/intern/bmesh_edgeloop.h @@ -0,0 +1,57 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2013 by Campbell Barton. + * All rights reserved. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __BMESH_EDGELOOP_H__ +#define __BMESH_EDGELOOP_H__ + +/** \file blender/bmesh/intern/bmesh_edgeloop.h + * \ingroup bmesh + */ + +struct ListBase; +struct BMEdgeLoopStore; + +/* multiple edgeloops (ListBase) */ +int BM_mesh_edgeloops_find(BMesh *bm, struct ListBase *r_lb, + bool (*test_fn)(BMEdge *, void *user_data), void *user_data); + +void BM_mesh_edgeloops_free(struct ListBase *eloops); +void BM_mesh_edgeloops_calc_center(BMesh *bm, struct ListBase *eloops); +void BM_mesh_edgeloops_calc_normal(BMesh *bm, struct ListBase *eloops); + + +/* single edgeloop */ +void BM_edgeloop_free(struct ListBase *eloops, struct BMEdgeLoopStore *el_store); +bool BM_edgeloop_is_closed(struct BMEdgeLoopStore *el_store); +int BM_edgeloop_length_get(struct BMEdgeLoopStore *el_store); +struct ListBase *BM_edgeloop_verts_get(struct BMEdgeLoopStore *el_store); +const float *BM_edgeloop_normal_get(struct BMEdgeLoopStore *el_store); +const float *BM_edgeloop_center_get(struct BMEdgeLoopStore *el_store); +void BM_edgeloop_calc_center(BMesh *bm, struct BMEdgeLoopStore *el_store); +void BM_edgeloop_calc_normal(BMesh *bm, struct BMEdgeLoopStore *el_store); +void BM_edgeloop_flip(BMesh *bm, struct BMEdgeLoopStore *el_store); + +#define BM_EDGELOOP_NEXT(el_store, elink) \ + (elink)->next ? elink->next : (BM_edgeloop_is_closed(el_store) ? BM_edgeloop_verts_get(el_store)->first : NULL) + +#endif /* __BMESH_EDGELOOP_H__ */ |