Blender V5.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
8
9#pragma once
10
11#include "BLI_compiler_attrs.hh"
13#include "BLI_utildefines.hh"
14
15#include "bmesh_class.hh"
16
17namespace blender {
18
24 bool BM_vert_in_edge(const BMEdge *e, const BMVert *v)
25{
26 return (ELEM(v, e->v1, e->v2));
27}
28
33 bool BM_edge_in_loop(const BMEdge *e, const BMLoop *l)
34{
35 return (l->e == e || l->prev->e == e);
36}
37
43 bool BM_verts_in_edge(const BMVert *v1, const BMVert *v2, const BMEdge *e)
44{
45 return ((e->v1 == v1 && e->v2 == v2) || (e->v1 == v2 && e->v2 == v1));
46}
47
53 const BMVert *v)
54{
55 if (e->v1 == v) {
56 return e->v2;
57 }
58 if (e->v2 == v) {
59 return e->v1;
60 }
61 return nullptr;
62}
63
69{
70 return (e->l == nullptr);
71}
72
77
78#if 1 /* fast path for checking manifold */
80{
81 const BMLoop *l = e->l;
82 return (l && (l->radial_next != l) && /* not 0 or 1 face users */
83 (l->radial_next->radial_next == l)); /* 2 face users */
84}
85#else
87{
88 return (BM_edge_face_count(e) == 2);
89}
90#endif
91
97{
98 const BMLoop *l = e->l;
99 const BMLoop *l_other;
100 return (l && ((l_other = l->radial_next) != l) && /* not 0 or 1 face users */
101 (l_other->radial_next == l) && /* 2 face users */
102 (l_other->v != l->v));
103}
104
109
110#if 1 /* fast path for checking boundary */
112{
113 const BMLoop *l = e->l;
114 return (l && (l->radial_next == l));
115}
116#else
118{
119 return (BM_edge_face_count(e) == 1);
120}
121#endif
122
127 bool BM_loop_is_adjacent(const BMLoop *l_a, const BMLoop *l_b)
128{
129 BLI_assert(l_a->f == l_b->f);
131 return (ELEM(l_b, l_a->next, l_a->prev));
132}
133
134ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) BLI_INLINE bool BM_loop_is_manifold(const BMLoop *l)
135{
136 return ((l != l->radial_next) && (l == l->radial_next->radial_next));
137}
138
142ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) BLI_INLINE bool BM_vert_is_wire_endpoint(const BMVert *v)
143{
144 const BMEdge *e = v->e;
145 if (e && e->l == nullptr) {
146 return (BM_DISK_EDGE_NEXT(e, v) == e);
147 }
148 return false;
149}
150
151} // namespace blender
#define ATTR_WARN_UNUSED_RESULT
#define ATTR_NONNULL(...)
#define BLI_INLINE
#define ELEM(...)
if(state< num_states)
BMesh Iterators.
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
int BM_edge_face_count(const BMEdge *e)
BLI_INLINE bool BM_edge_is_wire(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()
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert * v
BLI_INLINE bool BM_edge_is_manifold(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()
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_edge_is_contiguous(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMLoop * l_b
BLI_INLINE bool BM_edge_is_boundary(const BMEdge *e) 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()
ATTR_WARN_UNUSED_RESULT const BMVert * v2
bool ATTR_WARN_UNUSED_RESULT
void ATTR_NONNULL(1, 2)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
struct BMLoop * radial_next