Blender V4.3
bmesh_edgeloop.cc File Reference
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_math_vector.h"
#include "BLI_mempool.h"
#include "BLI_stack.h"
#include "BLI_utildefines_iter.h"
#include "bmesh.hh"
#include "bmesh_edgeloop.hh"

Go to the source code of this file.

Classes

struct  BMEdgeLoopStore
 
struct  VertStep
 

Macros

#define BM_EDGELOOP_IS_CLOSED   (1 << 0)
 
#define EDGELOOP_EPS   1e-10f
 
#define NODE_AS_V(n)   ((BMVert *)((LinkData *)n)->data)
 
#define NODE_AS_CO(n)   ((BMVert *)((LinkData *)n)->data)->co
 
#define EDGE_SPLIT(node_copy, node_other)
 

Functions

static int bm_vert_other_tag (BMVert *v, BMVert *v_prev, BMEdge **r_e)
 
static bool bm_loop_build (BMEdgeLoopStore *el_store, BMVert *v_prev, BMVert *v, int dir)
 
int BM_mesh_edgeloops_find (BMesh *bm, ListBase *r_eloops, bool(*test_fn)(BMEdge *, void *user_data), void *user_data)
 
static void vs_add (BLI_mempool *vs_pool, ListBase *lb, BMVert *v, BMEdge *e_prev, const int iter_tot)
 
static bool bm_loop_path_build_step (BLI_mempool *vs_pool, ListBase *lb, const int dir, BMVert *v_match[2])
 
bool BM_mesh_edgeloops_find_path (BMesh *bm, ListBase *r_eloops, bool(*test_fn)(BMEdge *, void *user_data), void *user_data, BMVert *v_src, BMVert *v_dst)
 
void BM_mesh_edgeloops_free (ListBase *eloops)
 
void BM_mesh_edgeloops_calc_center (BMesh *bm, ListBase *eloops)
 
void BM_mesh_edgeloops_calc_normal (BMesh *bm, ListBase *eloops)
 
void BM_mesh_edgeloops_calc_normal_aligned (BMesh *bm, ListBase *eloops, const float no_align[3])
 
void BM_mesh_edgeloops_calc_order (BMesh *, ListBase *eloops, const bool use_normals)
 
BMEdgeLoopStoreBM_edgeloop_copy (BMEdgeLoopStore *el_store)
 
BMEdgeLoopStoreBM_edgeloop_from_verts (BMVert **v_arr, const int v_arr_tot, bool is_closed)
 
void BM_edgeloop_free (BMEdgeLoopStore *el_store)
 
bool BM_edgeloop_is_closed (BMEdgeLoopStore *el_store)
 
ListBaseBM_edgeloop_verts_get (BMEdgeLoopStore *el_store)
 
int BM_edgeloop_length_get (BMEdgeLoopStore *el_store)
 
const floatBM_edgeloop_normal_get (BMEdgeLoopStore *el_store)
 
const floatBM_edgeloop_center_get (BMEdgeLoopStore *el_store)
 
void BM_edgeloop_edges_get (BMEdgeLoopStore *el_store, BMEdge **e_arr)
 
void BM_edgeloop_calc_center (BMesh *, BMEdgeLoopStore *el_store)
 
bool BM_edgeloop_calc_normal (BMesh *, BMEdgeLoopStore *el_store)
 
bool BM_edgeloop_calc_normal_aligned (BMesh *, BMEdgeLoopStore *el_store, const float no_align[3])
 
void BM_edgeloop_flip (BMesh *, BMEdgeLoopStore *el_store)
 
void BM_edgeloop_expand (BMesh *bm, BMEdgeLoopStore *el_store, int el_store_len, bool split, GSet *split_edges)
 
bool BM_edgeloop_overlap_check (BMEdgeLoopStore *el_store_a, BMEdgeLoopStore *el_store_b)
 

Detailed Description

Generic utility functions for getting edge loops from a mesh.

Definition in file bmesh_edgeloop.cc.

Macro Definition Documentation

◆ BM_EDGELOOP_IS_CLOSED

#define BM_EDGELOOP_IS_CLOSED   (1 << 0)

◆ EDGE_SPLIT

#define EDGE_SPLIT ( node_copy,
node_other )
Value:
{ \
BMVert *v_split, *v_other = static_cast<BMVert *>((node_other)->data); \
BMEdge *e_split, \
*e_other = BM_edge_exists(static_cast<BMVert *>((node_copy)->data), v_other); \
v_split = BM_edge_split(bm, \
e_other, \
static_cast<BMVert *>(split_swap ? (node_copy)->data : v_other), \
&e_split, \
0.0f); \
v_split->e = e_split; \
BLI_assert(v_split == e_split->v2); \
BLI_gset_insert(split_edges, e_split); \
(node_copy)->data = v_split; \
} \
((void)0)
ATTR_WARN_UNUSED_RESULT BMesh * bm
BMVert * BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float fac)
Edge Split.
BMEdge * BM_edge_exists(BMVert *v_a, BMVert *v_b)
BMVert * v2
struct BMEdge * e

Referenced by BM_edgeloop_expand().

◆ EDGELOOP_EPS

#define EDGELOOP_EPS   1e-10f

Definition at line 35 of file bmesh_edgeloop.cc.

Referenced by BM_edgeloop_calc_normal(), and BM_edgeloop_calc_normal_aligned().

◆ NODE_AS_CO

#define NODE_AS_CO ( n)    ((BMVert *)((LinkData *)n)->data)->co

◆ NODE_AS_V

#define NODE_AS_V ( n)    ((BMVert *)((LinkData *)n)->data)

Definition at line 549 of file bmesh_edgeloop.cc.

Referenced by BM_edgeloop_edges_get().

Function Documentation

◆ BM_edgeloop_calc_center()

◆ BM_edgeloop_calc_normal()

◆ BM_edgeloop_calc_normal_aligned()

bool BM_edgeloop_calc_normal_aligned ( BMesh * bm,
BMEdgeLoopStore * el_store,
const float no_align[3] )

For open loops that are straight lines, calculating the normal as if it were a polygon is meaningless.

Instead use an alignment vector and calculate the normal based on that.

Definition at line 639 of file bmesh_edgeloop.cc.

References add_v3_v3(), cross(), cross_v3_v3v3(), EDGELOOP_EPS, ListBase::first, ListBase::last, LinkData::next, BMEdgeLoopStore::no, NODE_AS_CO, normalize_v3(), sub_v3_v3v3(), UNLIKELY, BMEdgeLoopStore::verts, and zero_v3().

Referenced by bm_edgering_pair_interpolate(), BM_mesh_edgeloops_calc_normal_aligned(), and bridge_loop_pair().

◆ BM_edgeloop_center_get()

const float * BM_edgeloop_center_get ( BMEdgeLoopStore * el_store)

Definition at line 544 of file bmesh_edgeloop.cc.

References BMEdgeLoopStore::co.

Referenced by bm_edgering_pair_interpolate(), and bridge_loop_pair().

◆ BM_edgeloop_copy()

BMEdgeLoopStore * BM_edgeloop_copy ( BMEdgeLoopStore * el_store)

Copy a single edge-loop.

Returns
new edge-loops.

Definition at line 492 of file bmesh_edgeloop.cc.

References BLI_duplicatelist(), MEM_mallocN, and BMEdgeLoopStore::verts.

Referenced by bridge_loop_pair().

◆ BM_edgeloop_edges_get()

void BM_edgeloop_edges_get ( BMEdgeLoopStore * el_store,
BMEdge ** e_arr )

◆ BM_edgeloop_expand()

◆ BM_edgeloop_flip()

◆ BM_edgeloop_free()

void BM_edgeloop_free ( BMEdgeLoopStore * el_store)

◆ BM_edgeloop_from_verts()

BMEdgeLoopStore * BM_edgeloop_from_verts ( BMVert ** v_arr,
const int v_arr_tot,
bool is_closed )

◆ BM_edgeloop_is_closed()

◆ BM_edgeloop_length_get()

◆ BM_edgeloop_normal_get()

const float * BM_edgeloop_normal_get ( BMEdgeLoopStore * el_store)

Definition at line 539 of file bmesh_edgeloop.cc.

References BMEdgeLoopStore::no.

Referenced by bm_edgering_pair_interpolate(), and bridge_loop_pair().

◆ BM_edgeloop_overlap_check()

bool BM_edgeloop_overlap_check ( BMEdgeLoopStore * el_store_a,
BMEdgeLoopStore * el_store_b )

◆ BM_edgeloop_verts_get()

◆ bm_loop_build()

◆ bm_loop_path_build_step()

◆ BM_mesh_edgeloops_calc_center()

void BM_mesh_edgeloops_calc_center ( BMesh * bm,
ListBase * eloops )

Definition at line 399 of file bmesh_edgeloop.cc.

References bm, BM_edgeloop_calc_center(), and LISTBASE_FOREACH.

Referenced by bmo_bridge_loops_exec().

◆ BM_mesh_edgeloops_calc_normal()

void BM_mesh_edgeloops_calc_normal ( BMesh * bm,
ListBase * eloops )

Definition at line 406 of file bmesh_edgeloop.cc.

References bm, BM_edgeloop_calc_normal(), and LISTBASE_FOREACH.

Referenced by bmo_bridge_loops_exec().

◆ BM_mesh_edgeloops_calc_normal_aligned()

void BM_mesh_edgeloops_calc_normal_aligned ( BMesh * bm,
ListBase * eloops,
const float no_align[3] )

Definition at line 413 of file bmesh_edgeloop.cc.

References bm, BM_edgeloop_calc_normal_aligned(), and LISTBASE_FOREACH.

◆ BM_mesh_edgeloops_calc_order()

◆ BM_mesh_edgeloops_find()

◆ BM_mesh_edgeloops_find_path()

◆ BM_mesh_edgeloops_free()

◆ bm_vert_other_tag()

static int bm_vert_other_tag ( BMVert * v,
BMVert * v_prev,
BMEdge ** r_e )
static

◆ vs_add()

static void vs_add ( BLI_mempool * vs_pool,
ListBase * lb,
BMVert * v,
BMEdge * e_prev,
const int iter_tot )
static