Blender V4.3
bmesh_query_inline.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#pragma once
10
16 bool BM_vert_in_edge(const BMEdge *e, const BMVert *v)
17{
18 return (ELEM(v, e->v1, e->v2));
19}
20
25 bool BM_edge_in_loop(const BMEdge *e, const BMLoop *l)
26{
27 return (l->e == e || l->prev->e == e);
28}
29
35 bool BM_verts_in_edge(const BMVert *v1, const BMVert *v2, const BMEdge *e)
36{
37 return ((e->v1 == v1 && e->v2 == v2) || (e->v1 == v2 && e->v2 == v1));
38}
39
45 const BMVert *v)
46{
47 if (e->v1 == v) {
48 return e->v2;
49 }
50 else if (e->v2 == v) {
51 return e->v1;
52 }
53 return NULL;
54}
55
61{
62 return (e->l == NULL);
63}
64
70#if 1 /* fast path for checking manifold */
72{
73 const BMLoop *l = e->l;
74 return (l && (l->radial_next != l) && /* not 0 or 1 face users */
75 (l->radial_next->radial_next == l)); /* 2 face users */
76}
77#else
79{
80 return (BM_edge_face_count(e) == 2);
81}
82#endif
83
89{
90 const BMLoop *l = e->l;
91 const BMLoop *l_other;
92 return (l && ((l_other = l->radial_next) != l) && /* not 0 or 1 face users */
93 (l_other->radial_next == l) && /* 2 face users */
94 (l_other->v != l->v));
95}
96
102#if 1 /* fast path for checking boundary */
104{
105 const BMLoop *l = e->l;
106 return (l && (l->radial_next == l));
107}
108#else
110{
111 return (BM_edge_face_count(e) == 1);
112}
113#endif
114
119 bool BM_loop_is_adjacent(const BMLoop *l_a, const BMLoop *l_b)
120{
121 BLI_assert(l_a->f == l_b->f);
123 return (ELEM(l_b, l_a->next, l_a->prev));
124}
125
126ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) BLI_INLINE bool BM_loop_is_manifold(const BMLoop *l)
127{
128 return ((l != l->radial_next) && (l == l->radial_next->radial_next));
129}
130
134ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) BLI_INLINE bool BM_vert_is_wire_endpoint(const BMVert *v)
135{
136 const BMEdge *e = v->e;
137 if (e && e->l == NULL) {
138 return (BM_DISK_EDGE_NEXT(e, v) == e);
139 }
140 return false;
141}
#define BLI_assert(a)
Definition BLI_assert.h:50
#define ATTR_WARN_UNUSED_RESULT
#define ATTR_NONNULL(...)
#define BLI_INLINE
#define ELEM(...)
#define BM_DISK_EDGE_NEXT(e, v)
int BM_edge_face_count(const BMEdge *e)
BLI_INLINE bool BM_edge_is_contiguous(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE bool BM_edge_is_manifold(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE bool BM_edge_is_boundary(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE bool BM_loop_is_adjacent(const BMLoop *l_a, const BMLoop *l_b) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE bool BM_edge_in_loop(const BMEdge *e, const BMLoop *l) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE bool BM_verts_in_edge(const BMVert *v1, const BMVert *v2, const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE bool BM_edge_is_wire(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE bool BM_vert_in_edge(const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMLoop * l_b
ATTR_WARN_UNUSED_RESULT const BMVert * v
#define NULL
struct BMVert * v
struct BMEdge * e
struct BMLoop * radial_next
struct BMLoop * prev
struct BMFace * f
struct BMLoop * next
struct BMEdge * e