Blender  V3.3
Macros | Functions
bmesh_query.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_alloca.h"
#include "BLI_linklist.h"
#include "BLI_math.h"
#include "BLI_utildefines_stack.h"
#include "BKE_customdata.h"
#include "bmesh.h"
#include "intern/bmesh_private.h"

Go to the source code of this file.

Macros

#define LOOP_VISIT   _FLAG_WALK
 
#define EDGE_VISIT   _FLAG_WALK
 

Functions

BMLoopBM_face_other_edge_loop (BMFace *f, BMEdge *e, BMVert *v)
 Other Loop in Face Sharing an Edge. More...
 
BMLoopBM_loop_other_edge_loop (BMLoop *l, BMVert *v)
 
BMLoopBM_face_other_vert_loop (BMFace *f, BMVert *v_prev, BMVert *v)
 Other Loop in Face Sharing a Vertex. More...
 
BMLoopBM_loop_other_vert_loop (BMLoop *l, BMVert *v)
 Other Loop in Face Sharing a Vert. More...
 
BMLoopBM_loop_other_vert_loop_by_edge (BMLoop *l, BMEdge *e)
 
bool BM_vert_pair_share_face_check (BMVert *v_a, BMVert *v_b)
 
bool BM_vert_pair_share_face_check_cb (BMVert *v_a, BMVert *v_b, bool(*test_fn)(BMFace *, void *user_data), void *user_data)
 
BMFaceBM_vert_pair_shared_face_cb (BMVert *v_a, BMVert *v_b, const bool allow_adjacent, bool(*callback)(BMFace *, BMLoop *, BMLoop *, void *userdata), void *user_data, BMLoop **r_l_a, BMLoop **r_l_b)
 
BMFaceBM_vert_pair_share_face_by_len (BMVert *v_a, BMVert *v_b, BMLoop **r_l_a, BMLoop **r_l_b, const bool allow_adjacent)
 
BMFaceBM_edge_pair_share_face_by_len (BMEdge *e_a, BMEdge *e_b, BMLoop **r_l_a, BMLoop **r_l_b, const bool allow_adjacent)
 
static float bm_face_calc_split_dot (BMLoop *l_a, BMLoop *l_b)
 
float BM_loop_point_side_of_loop_test (const BMLoop *l, const float co[3])
 
float BM_loop_point_side_of_edge_test (const BMLoop *l, const float co[3])
 
BMFaceBM_vert_pair_share_face_by_angle (BMVert *v_a, BMVert *v_b, BMLoop **r_l_a, BMLoop **r_l_b, const bool allow_adjacent)
 
BMLoopBM_vert_find_first_loop (BMVert *v)
 
BMLoopBM_vert_find_first_loop_visible (BMVert *v)
 
bool BM_vert_in_face (BMVert *v, BMFace *f)
 
int BM_verts_in_face_count (BMVert **varr, int len, BMFace *f)
 
bool BM_verts_in_face (BMVert **varr, int len, BMFace *f)
 
bool BM_edge_in_face (const BMEdge *e, const BMFace *f)
 
BMLoopBM_edge_other_loop (BMEdge *e, BMLoop *l)
 
BMLoopBM_vert_step_fan_loop (BMLoop *l, BMEdge **e_step)
 
BMEdgeBM_vert_other_disk_edge (BMVert *v, BMEdge *e_first)
 
float BM_edge_calc_length (const BMEdge *e)
 
float BM_edge_calc_length_squared (const BMEdge *e)
 
bool BM_edge_face_pair (BMEdge *e, BMFace **r_fa, BMFace **r_fb)
 
bool BM_edge_loop_pair (BMEdge *e, BMLoop **r_la, BMLoop **r_lb)
 
bool BM_vert_is_edge_pair (const BMVert *v)
 
bool BM_vert_is_edge_pair_manifold (const BMVert *v)
 
bool BM_vert_edge_pair (BMVert *v, BMEdge **r_e_a, BMEdge **r_e_b)
 
int BM_vert_edge_count (const BMVert *v)
 
int BM_vert_edge_count_at_most (const BMVert *v, const int count_max)
 
int BM_vert_edge_count_nonwire (const BMVert *v)
 
int BM_edge_face_count (const BMEdge *e)
 
int BM_edge_face_count_at_most (const BMEdge *e, const int count_max)
 
int BM_vert_face_count (const BMVert *v)
 
int BM_vert_face_count_at_most (const BMVert *v, int count_max)
 
bool BM_vert_face_check (const BMVert *v)
 
bool BM_vert_is_wire (const BMVert *v)
 
bool BM_vert_is_manifold (const BMVert *v)
 
static int bm_loop_region_count__recursive (BMEdge *e, BMVert *v)
 
static int bm_loop_region_count__clear (BMLoop *l)
 
int BM_loop_region_loops_count_at_most (BMLoop *l, int *r_loop_total)
 
int BM_loop_region_loops_count (BMLoop *l)
 
bool BM_vert_is_manifold_region (const BMVert *v)
 
bool BM_edge_is_convex (const BMEdge *e)
 
bool BM_edge_is_contiguous_loop_cd (const BMEdge *e, const int cd_loop_type, const int cd_loop_offset)
 
bool BM_vert_is_boundary (const BMVert *v)
 
int BM_face_share_face_count (BMFace *f_a, BMFace *f_b)
 
bool BM_face_share_face_check (BMFace *f_a, BMFace *f_b)
 
int BM_face_share_edge_count (BMFace *f_a, BMFace *f_b)
 
bool BM_face_share_edge_check (BMFace *f1, BMFace *f2)
 
int BM_face_share_vert_count (BMFace *f_a, BMFace *f_b)
 
bool BM_face_share_vert_check (BMFace *f_a, BMFace *f_b)
 
bool BM_loop_share_edge_check (BMLoop *l_a, BMLoop *l_b)
 
bool BM_edge_share_face_check (BMEdge *e1, BMEdge *e2)
 
bool BM_edge_share_quad_check (BMEdge *e1, BMEdge *e2)
 
bool BM_edge_share_vert_check (BMEdge *e1, BMEdge *e2)
 
BMVertBM_edge_share_vert (BMEdge *e1, BMEdge *e2)
 
BMLoopBM_edge_vert_share_loop (BMLoop *l, BMVert *v)
 Return the Loop Shared by Edge and Vert. More...
 
BMLoopBM_face_vert_share_loop (BMFace *f, BMVert *v)
 Return the Loop Shared by Face and Vertex. More...
 
BMLoopBM_face_edge_share_loop (BMFace *f, BMEdge *e)
 Return the Loop Shared by Face and Edge. More...
 
void BM_edge_ordered_verts_ex (const BMEdge *edge, BMVert **r_v1, BMVert **r_v2, const BMLoop *edge_loop)
 
void BM_edge_ordered_verts (const BMEdge *edge, BMVert **r_v1, BMVert **r_v2)
 
BMLoopBM_loop_find_prev_nodouble (BMLoop *l, BMLoop *l_stop, const float eps_sq)
 
BMLoopBM_loop_find_next_nodouble (BMLoop *l, BMLoop *l_stop, const float eps_sq)
 
bool BM_loop_is_convex (const BMLoop *l)
 
float BM_loop_calc_face_angle (const BMLoop *l)
 
float BM_loop_calc_face_normal_safe_ex (const BMLoop *l, const float epsilon_sq, float r_normal[3])
 BM_loop_calc_face_normal. More...
 
float BM_loop_calc_face_normal_safe_vcos_ex (const BMLoop *l, const float normal_fallback[3], float const (*vertexCos)[3], const float epsilon_sq, float r_normal[3])
 
float BM_loop_calc_face_normal_safe (const BMLoop *l, float r_normal[3])
 
float BM_loop_calc_face_normal_safe_vcos (const BMLoop *l, const float normal_fallback[3], float const (*vertexCos)[3], float r_normal[3])
 
float BM_loop_calc_face_normal (const BMLoop *l, float r_normal[3])
 BM_loop_calc_face_normal. More...
 
void BM_loop_calc_face_direction (const BMLoop *l, float r_dir[3])
 BM_loop_calc_face_direction. More...
 
void BM_loop_calc_face_tangent (const BMLoop *l, float r_tangent[3])
 BM_loop_calc_face_tangent. More...
 
float BM_edge_calc_face_angle_ex (const BMEdge *e, const float fallback)
 BMESH EDGE/FACE ANGLE. More...
 
float BM_edge_calc_face_angle (const BMEdge *e)
 
float BM_edge_calc_face_angle_with_imat3_ex (const BMEdge *e, const float imat3[3][3], const float fallback)
 BMESH EDGE/FACE ANGLE. More...
 
float BM_edge_calc_face_angle_with_imat3 (const BMEdge *e, const float imat3[3][3])
 
float BM_edge_calc_face_angle_signed_ex (const BMEdge *e, const float fallback)
 BMESH EDGE/FACE ANGLE. More...
 
float BM_edge_calc_face_angle_signed (const BMEdge *e)
 
void BM_edge_calc_face_tangent (const BMEdge *e, const BMLoop *e_loop, float r_tangent[3])
 BMESH EDGE/FACE TANGENT. More...
 
float BM_vert_calc_edge_angle_ex (const BMVert *v, const float fallback)
 BMESH VERT/EDGE ANGLE. More...
 
float BM_vert_calc_edge_angle (const BMVert *v)
 
float BM_vert_calc_shell_factor (const BMVert *v)
 
float BM_vert_calc_shell_factor_ex (const BMVert *v, const float no[3], const char hflag)
 
float BM_vert_calc_median_tagged_edge_length (const BMVert *v)
 
BMLoopBM_face_find_shortest_loop (BMFace *f)
 
BMLoopBM_face_find_longest_loop (BMFace *f)
 
BMEdgeBM_edge_exists (BMVert *v_a, BMVert *v_b)
 
BMEdgeBM_edge_find_double (BMEdge *e)
 
BMLoopBM_edge_find_first_loop_visible (BMEdge *e)
 
BMFaceBM_face_exists (BMVert **varr, int len)
 
BMFaceBM_face_find_double (BMFace *f)
 
bool BM_face_exists_multi (BMVert **varr, BMEdge **earr, int len)
 
bool BM_face_exists_multi_edge (BMEdge **earr, int len)
 
BMFaceBM_face_exists_overlap (BMVert **varr, const int len)
 
bool BM_face_exists_overlap_subset (BMVert **varr, const int len)
 
bool BM_vert_is_all_edge_flag_test (const BMVert *v, const char hflag, const bool respect_hide)
 
bool BM_vert_is_all_face_flag_test (const BMVert *v, const char hflag, const bool respect_hide)
 
bool BM_edge_is_all_face_flag_test (const BMEdge *e, const char hflag, const bool respect_hide)
 
bool BM_edge_is_any_face_flag_test (const BMEdge *e, const char hflag)
 
bool BM_edge_is_any_vert_flag_test (const BMEdge *e, const char hflag)
 
bool BM_face_is_any_vert_flag_test (const BMFace *f, const char hflag)
 
bool BM_face_is_any_edge_flag_test (const BMFace *f, const char hflag)
 
bool BM_edge_is_any_face_len_test (const BMEdge *e, const int len)
 
bool BM_face_is_normal_valid (const BMFace *f)
 
static double bm_mesh_calc_volume_face (const BMFace *f)
 
double BM_mesh_calc_volume (BMesh *bm, bool is_signed)
 
int BM_mesh_calc_face_groups (BMesh *bm, int *r_groups_array, int(**r_group_index)[2], BMLoopFilterFunc filter_fn, BMLoopPairFilterFunc filter_pair_fn, void *user_data, const char hflag_test, const char htype_step)
 
int BM_mesh_calc_edge_groups (BMesh *bm, int *r_groups_array, int(**r_group_index)[2], BMVertFilterFunc filter_fn, void *user_data, const char hflag_test)
 
int BM_mesh_calc_edge_groups_as_arrays (BMesh *bm, BMVert **verts, BMEdge **edges, BMFace **faces, int(**r_groups)[3])
 
float bmesh_subd_falloff_calc (const int falloff, float val)
 

Detailed Description

This file contains functions for answering common Topological and geometric queries about a mesh, such as, "What is the angle between these two faces?" or, "How many faces are incident upon this vertex?" Tool authors should use the functions in this file instead of inspecting the mesh structure directly.

Definition in file bmesh_query.c.

Macro Definition Documentation

◆ EDGE_VISIT

#define EDGE_VISIT   _FLAG_WALK

Definition at line 765 of file bmesh_query.c.

◆ LOOP_VISIT

#define LOOP_VISIT   _FLAG_WALK

Definition at line 764 of file bmesh_query.c.

Function Documentation

◆ BM_edge_calc_face_angle()

float BM_edge_calc_face_angle ( const BMEdge e)

Definition at line 1338 of file bmesh_query.c.

References BM_edge_calc_face_angle_ex(), DEG2RADF, and e.

Referenced by bm_vert_edge_face_angle().

◆ BM_edge_calc_face_angle_ex()

float BM_edge_calc_face_angle_ex ( const BMEdge e,
float  fallback 
)

BMESH EDGE/FACE ANGLE.

Calculates the angle between two faces. Assumes the face normals are correct.

Returns
angle in radians

Definition at line 1329 of file bmesh_query.c.

References angle_normalized_v3v3(), BM_edge_is_manifold(), e, BMLoop::f, and BMFace::no.

Referenced by BM_edge_calc_face_angle(), bpy_bmedge_calc_face_angle(), and edbm_beautify_fill_exec().

◆ BM_edge_calc_face_angle_signed()

float BM_edge_calc_face_angle_signed ( const BMEdge e)

Definition at line 1379 of file bmesh_query.c.

References BM_edge_calc_face_angle_signed_ex(), DEG2RADF, and e.

Referenced by blender::draw::statvis_calc_sharp().

◆ BM_edge_calc_face_angle_signed_ex()

float BM_edge_calc_face_angle_signed_ex ( const BMEdge e,
float  fallback 
)

BMESH EDGE/FACE ANGLE.

Calculates the angle between two faces. Assumes the face normals are correct.

Returns
angle in radians

Definition at line 1369 of file bmesh_query.c.

References angle(), angle_normalized_v3v3(), BM_edge_is_convex(), BM_edge_is_manifold(), e, BMLoop::f, and BMFace::no.

Referenced by BM_edge_calc_face_angle_signed(), bpy_bmedge_calc_face_angle_signed(), and tri_corner_test().

◆ BM_edge_calc_face_angle_with_imat3()

float BM_edge_calc_face_angle_with_imat3 ( const BMEdge e,
const float  imat3[3][3] 
)

Definition at line 1364 of file bmesh_query.c.

References BM_edge_calc_face_angle_with_imat3_ex(), DEG2RADF, and e.

Referenced by similar_edge_select_exec().

◆ BM_edge_calc_face_angle_with_imat3_ex()

float BM_edge_calc_face_angle_with_imat3_ex ( const BMEdge e,
const float  imat3[3][3],
float  fallback 
)

BMESH EDGE/FACE ANGLE.

Calculates the angle between two faces in world space. Assumes the face normals are correct.

Returns
angle in radians

Definition at line 1343 of file bmesh_query.c.

References angle_normalized_v3v3(), BM_edge_is_manifold(), copy_v3_v3(), e, BMLoop::f, mul_transposed_m3_v3(), BMFace::no, and normalize_v3().

Referenced by BM_edge_calc_face_angle_with_imat3().

◆ BM_edge_calc_face_tangent()

void BM_edge_calc_face_tangent ( const BMEdge e,
const BMLoop e_loop,
float  r_tangent[3] 
)

BMESH EDGE/FACE TANGENT.

Calculate the tangent at this loop corner or fallback to the face normal on straight lines. This vector always points inward into the face.

BM_edge_calc_face_tangent

Parameters
e
e_loopThe loop to calculate the tangent at, used to get the face and winding direction.
r_tangentThe loop corner tangent to set

Definition at line 1384 of file bmesh_query.c.

References BM_edge_ordered_verts_ex(), BMVert::co, cross_v3_v3v3(), e, BMLoop::f, BMFace::no, normalize_v3(), sub_v3_v3v3(), v1, and v2.

Referenced by bm_vert_boundary_tangent(), bm_vert_calc_surface_tangent(), bmo_face_inset_individual(), bmo_inset_region_exec(), and bpy_bmedge_calc_tangent().

◆ BM_edge_calc_length()

float BM_edge_calc_length ( const BMEdge e)

◆ BM_edge_calc_length_squared()

float BM_edge_calc_length_squared ( const BMEdge e)

◆ BM_edge_exists()

BMEdge* BM_edge_exists ( BMVert v_a,
BMVert v_b 
)

Returns the edge existing between v_a and v_b, or NULL if there isn't one.

Note
multiple edges may exist between any two vertices, and therefore this function only returns the first one found.

Definition at line 1553 of file bmesh_query.c.

References BLI_assert, BM_VERT, BM_vert_in_edge(), bmesh_disk_edge_next(), BMVert::e, BMVert::head, BMHeader::htype, and NULL.

Referenced by bev_rebuild_polygon(), bevel_build_edge_polygons(), BKE_mesh_remesh_voxel_fix_poles(), BM_edge_create(), BM_edge_rotate(), BM_edge_rotate_check_degenerate(), BM_edgeloop_edges_get(), bm_edgeloop_flag_set(), bm_edgenet_path_calc_best(), bm_edgering_pair_order(), bm_edgering_pair_order_is_flipped(), BM_edges_from_verts(), bm_face_connect_verts(), BM_face_create_ngon_verts(), BM_face_other_vert_loop(), bm_face_split_edge_find(), BM_face_split_edgenet_connect_islands(), bm_grid_fill(), bm_isect_edge_tri(), bm_isect_tri_tri(), bm_loop_pair_from_verts(), BM_mesh_intersect(), BM_mesh_intersect_edges(), BM_mesh_wireframe(), bm_vert_connect_select_history(), bm_vert_loop_pair(), BM_vert_splice_check_double(), bmesh_kernel_join_edge_kill_vert(), bmesh_kernel_join_vert_kill_edge(), bmo_extrude_face_region_exec(), bmo_subdivide_edges_exec(), bmo_triangle_fill_exec(), bmo_weld_verts_exec(), bmw_EdgeLoopWalker_step(), bpy_bm_utils_vert_splice(), bpy_bmedgeseq_get__method(), bpy_bmedgeseq_new(), bridge_loop_pair(), build_hull(), edbm_add_edge_face_exec__tricky_extend_sel(), EDBM_verts_mirror_get_edge(), getTransformOrientation_ex(), is_vertex_diagonal(), knife_add_single_cut(), knife_make_face_cuts(), pbvh_bmesh_collapse_short_edges(), pbvh_bmesh_subdivide_long_edges(), remdoubles_createface(), skin_frame_find_contained_faces(), and weld_cross_attrs_copy().

◆ BM_edge_face_count()

int BM_edge_face_count ( const BMEdge e)

◆ BM_edge_face_count_at_most()

int BM_edge_face_count_at_most ( const BMEdge e,
const int  count_max 
)

Definition at line 645 of file bmesh_query.c.

References count, e, and BMLoop::radial_next.

Referenced by similar_edge_select_exec().

◆ BM_edge_face_pair()

bool BM_edge_face_pair ( BMEdge e,
BMFace **  r_fa,
BMFace **  r_fb 
)

Utility function, since enough times we have an edge and want to access 2 connected faces.

Returns
true when only 2 faces are found.

Definition at line 538 of file bmesh_query.c.

References e, BMLoop::f, NULL, and BMLoop::radial_next.

Referenced by BM_edge_calc_rotate(), BM_edge_rotate(), BM_edge_rotate_check(), bm_face_split_by_edges_island_connect(), bmo_dissolve_edges_exec(), bmo_join_triangles_exec(), bmo_rotate_edges_exec(), edbm_edge_rotate_selected_exec(), hull_merge_triangles(), and skin_frame_find_contained_faces().

◆ BM_edge_find_double()

BMEdge* BM_edge_find_double ( BMEdge e)

Returns an edge sharing the same vertices as this one. This isn't an invalid state but tools should clean up these cases before returning the mesh to the user.

Definition at line 1581 of file bmesh_query.c.

References BM_vert_in_edge(), bmesh_disk_edge_next(), e, NULL, UNLIKELY, and v.

Referenced by bm_decim_edge_collapse(), BM_face_split_edgenet_connect_islands(), BM_mesh_edgesplit(), and bmo_spin_exec().

◆ BM_edge_find_first_loop_visible()

BMLoop* BM_edge_find_first_loop_visible ( BMEdge e)

Only BMEdge.l access us needed, however when we want the first visible loop, a utility function is needed.

Definition at line 1598 of file bmesh_query.c.

References BM_elem_flag_test, BM_ELEM_HIDDEN, e, BMLoop::f, NULL, and BMLoop::radial_next.

◆ BM_edge_in_face()

bool BM_edge_in_face ( const BMEdge e,
const BMFace f 
)

◆ BM_edge_is_all_face_flag_test()

bool BM_edge_is_all_face_flag_test ( const BMEdge e,
const char  hflag,
const bool  respect_hide 
)

◆ BM_edge_is_any_face_flag_test()

bool BM_edge_is_any_face_flag_test ( const BMEdge e,
const char  hflag 
)

Definition at line 1968 of file bmesh_query.c.

References BM_elem_flag_test, e, BMLoop::f, and BMLoop::radial_next.

Referenced by edbm_select_linked_exec().

◆ BM_edge_is_any_face_len_test()

bool BM_edge_is_any_face_len_test ( const BMEdge e,
const int  len 
)

◆ BM_edge_is_any_vert_flag_test()

bool BM_edge_is_any_vert_flag_test ( const BMEdge e,
const char  hflag 
)

Definition at line 1984 of file bmesh_query.c.

References BM_elem_flag_test, and e.

Referenced by EDBM_selectmode_convert().

◆ BM_edge_is_contiguous_loop_cd()

bool BM_edge_is_contiguous_loop_cd ( const BMEdge e,
int  cd_loop_type,
int  cd_loop_offset 
)
Returns
true when loop customdata is contiguous.

Definition at line 875 of file bmesh_query.c.

References BLI_assert, BM_ELEM_CD_GET_VOID_P, CustomData_data_equals(), e, BMLoop::next, BMLoop::radial_next, and BMLoop::v.

Referenced by bm_edge_is_contiguous_loop_cd_all(), and select_linked_delimit_test().

◆ BM_edge_is_convex()

bool BM_edge_is_convex ( const BMEdge e)

Check if the edge is convex or concave (depends on face winding)

Definition at line 858 of file bmesh_query.c.

References BM_edge_is_manifold(), BMVert::co, blender::math::cross(), cross_v3_v3v3(), dot_v3v3(), e, equals_v3v3(), BMLoop::f, BMLoop::next, BMFace::no, sub_v3_v3v3(), and BMLoop::v.

Referenced by BM_edge_calc_face_angle_signed_ex(), and bpy_bmedge_is_convex_get().

◆ BM_edge_loop_pair()

bool BM_edge_loop_pair ( BMEdge e,
BMLoop **  r_la,
BMLoop **  r_lb 
)

◆ BM_edge_ordered_verts()

void BM_edge_ordered_verts ( const BMEdge edge,
BMVert **  r_v1,
BMVert **  r_v2 
)

◆ BM_edge_ordered_verts_ex()

void BM_edge_ordered_verts_ex ( const BMEdge edge,
BMVert **  r_v1,
BMVert **  r_v2,
const BMLoop edge_loop 
)

Returns the verts of an edge as used in a face if used in a face at all, otherwise just assign as used in the edge.

Useful to get a deterministic winding order when calling BM_face_create_ngon() on an arbitrary array of verts, though be sure to pick an edge which has a face.

Note
This is in fact quite a simple check, mainly include this function so the intent is more obvious. We know these 2 verts will always make up the loops edge

Definition at line 1130 of file bmesh_query.c.

References BLI_assert, BMLoop::e, BMLoop::next, BMLoop::v, and void.

Referenced by BM_edge_calc_face_tangent(), BM_edge_ordered_verts(), and bmo_inset_region_exec().

◆ BM_edge_other_loop()

BMLoop* BM_edge_other_loop ( BMEdge e,
BMLoop l 
)

Given a edge and a loop (assumes the edge is manifold). returns the other faces loop, sharing the same vertex.

+-------------------+
|                   |
|                   |
|l_other <-- return |
+-------------------+ <-- A manifold edge between 2 faces
|l    e  <-- edge   |
|^ <-------- loop   |
|                   |
+-------------------+

Definition at line 436 of file bmesh_query.c.

References BLI_assert, BM_vert_in_edge(), BMLoop::e, e, l, BMLoop::next, BMLoop::prev, BMLoop::radial_next, and BMLoop::v.

Referenced by bm_extrude_copy_face_loop_attributes(), bm_loop_customdata_merge(), BM_vert_step_fan_loop(), bmo_inset_region_exec(), and edbm_tagged_loop_pairs_do_fill_faces().

◆ BM_edge_pair_share_face_by_len()

BMFace* BM_edge_pair_share_face_by_len ( BMEdge e_a,
BMEdge e_b,
BMLoop **  r_l_a,
BMLoop **  r_l_b,
const bool  allow_adjacent 
)

◆ BM_edge_share_face_check()

bool BM_edge_share_face_check ( BMEdge e1,
BMEdge e2 
)

◆ BM_edge_share_quad_check()

bool BM_edge_share_quad_check ( BMEdge e1,
BMEdge e2 
)

Test if e1 shares any quad faces with e2

Definition at line 1054 of file bmesh_query.c.

References BM_edge_in_face(), BMLoop::f, BMEdge::l, l, BMFace::len, and BMLoop::radial_next.

Referenced by edge_step(), and view3d_preselect_mesh_edgering_update_edges_from_edge().

◆ BM_edge_share_vert()

BMVert* BM_edge_share_vert ( BMEdge e1,
BMEdge e2 
)

Return the shared vertex between the two edges or NULL

Definition at line 1079 of file bmesh_query.c.

References BLI_assert, BM_vert_in_edge(), NULL, BMEdge::v1, and BMEdge::v2.

Referenced by bm_edge_collapse(), BM_verts_from_edges(), edbm_tagged_loop_pairs_do_fill_faces(), and get_next_loop().

◆ BM_edge_share_vert_check()

bool BM_edge_share_vert_check ( BMEdge e1,
BMEdge e2 
)

Tests to see if e1 shares a vertex with e2

Definition at line 1074 of file bmesh_query.c.

References BMEdge::v1, and BMEdge::v2.

Referenced by bm_edgexedge_isect_cb(), BM_mesh_decimate_collapse(), bmo_edgenet_prepare_exec(), and bmo_subdivide_edges_exec().

◆ BM_edge_vert_share_loop()

BMLoop* BM_edge_vert_share_loop ( BMLoop l,
BMVert v 
)

Return the Loop Shared by Edge and Vert.

Finds the loop used which uses in face loop l

Note
this function takes a loop rather than an edge so we can select the face that the loop should be from.

Definition at line 1091 of file bmesh_query.c.

References BLI_assert, BM_vert_in_edge(), BMLoop::e, l, BMLoop::next, BMLoop::v, and v.

Referenced by edbm_rip_invoke__vert().

◆ bm_face_calc_split_dot()

static float bm_face_calc_split_dot ( BMLoop l_a,
BMLoop l_b 
)
static

Definition at line 221 of file bmesh_query.c.

References BM_face_calc_normal_subset(), dot_v3v3(), and l_b.

Referenced by BM_vert_pair_share_face_by_angle().

◆ BM_face_edge_share_loop()

BMLoop* BM_face_edge_share_loop ( BMFace f,
BMEdge e 
)

◆ BM_face_exists()

BMFace* BM_face_exists ( BMVert **  varr,
int  len 
)

Given a set of vertices (varr), find out if there is a face with exactly those vertices (and only those vertices).

Note
there used to be a BM_face_exists_overlap function that checks for partial overlap.

Definition at line 1612 of file bmesh_query.c.

References BM_DISK_EDGE_NEXT, BMVert::e, e, BMLoop::f, BMEdge::l, BMFace::len, len, BMLoop::next, NULL, BMLoop::prev, BMLoop::radial_next, and BMLoop::v.

Referenced by BM_face_create(), bm_vert_dissolve_fan_test(), bmo_edgeloop_fill_exec(), bpy_bmfaceseq_get__method(), bpy_bmfaceseq_new(), bridge_loop_pair(), edbm_tagged_loop_pairs_do_fill_faces(), EDBM_verts_mirror_get_face(), pbvh_bmesh_collapse_edge(), pbvh_bmesh_face_create(), and remdoubles_createface().

◆ BM_face_exists_multi()

bool BM_face_exists_multi ( BMVert **  varr,
BMEdge **  earr,
int  len 
)

Given a set of vertices and edges (varr, earr), find out if all those vertices are filled in by existing faces that only use those vertices.

This is for use in cases where creating a face is possible but would result in many overlapping faces.

An example of how this is used: when 2 tri's are selected that share an edge, pressing F-key would make a new overlapping quad (without a check like this)

earr and varr can be in any order, however they must form a closed loop.

Definition at line 1692 of file bmesh_query.c.

References BM_EDGES_OF_VERT, BM_elem_flag_disable, BM_elem_flag_enable, BM_elem_flag_test, BM_ELEM_INTERNAL_TAG, BM_FACES_OF_EDGE, BM_ITER_ELEM, BM_VERTS_OF_FACE, e, len, and v.

Referenced by bm_edgenet_face_from_path(), and BM_face_exists_multi_edge().

◆ BM_face_exists_multi_edge()

bool BM_face_exists_multi_edge ( BMEdge **  earr,
int  len 
)

◆ BM_face_exists_overlap()

BMFace* BM_face_exists_overlap ( BMVert **  varr,
int  len 
)

Given a set of vertices (varr), find out if all those vertices overlap an existing face.

Note
The face may contain other verts not in varr.
Its possible there are more than one overlapping faces, in this case the first one found will be returned.
Parameters
varrArray of unordered verts.
lenvarr array length.
Returns
The face or NULL.

Definition at line 1813 of file bmesh_query.c.

References _FLAG_OVERLAP, BLI_assert, BLI_linklist_prepend_alloca, BM_ELEM_API_FLAG_DISABLE, BM_ELEM_API_FLAG_ENABLE, BM_ELEM_API_FLAG_TEST, BM_FACES_OF_VERT, BM_ITER_ELEM, BM_verts_in_face_count(), len, LinkNode::link, LinkNode::next, and NULL.

◆ BM_face_exists_overlap_subset()

bool BM_face_exists_overlap_subset ( BMVert **  varr,
int  len 
)

Given a set of vertices (varr), find out if there is a face that uses vertices only from this list (that the face is a subset or made from the vertices given).

Parameters
varrArray of unordered verts.
lenvarr array length.

Definition at line 1851 of file bmesh_query.c.

References _FLAG_OVERLAP, BLI_assert, BLI_linklist_prepend_alloca, BM_ELEM_API_FLAG_DISABLE, BM_ELEM_API_FLAG_ENABLE, BM_ELEM_API_FLAG_TEST, BM_FACE_FIRST_LOOP, BM_FACES_OF_VERT, BM_ITER_ELEM, BMFace::len, len, LinkNode::link, LinkNode::next, BMLoop::next, NULL, and BMLoop::v.

Referenced by bm_edgenet_path_check_overlap().

◆ BM_face_find_double()

BMFace* BM_face_find_double ( BMFace f)

◆ BM_face_find_longest_loop()

BMLoop* BM_face_find_longest_loop ( BMFace f)

Returns the loop of the longest edge in f.

Definition at line 1508 of file bmesh_query.c.

References BM_FACE_FIRST_LOOP, BMVert::co, len_squared_v3v3(), BMLoop::next, NULL, and BMLoop::v.

Referenced by BM_face_calc_tangent_edge(), BM_face_calc_tangent_edge_pair(), and skin_fix_hole_no_good_verts().

◆ BM_face_find_shortest_loop()

BMLoop* BM_face_find_shortest_loop ( BMFace f)

Returns the loop of the shortest edge in f.

Definition at line 1487 of file bmesh_query.c.

References BM_FACE_FIRST_LOOP, BMVert::co, len_squared_v3v3(), BMLoop::next, NULL, and BMLoop::v.

Referenced by collapse_face_corners().

◆ BM_face_is_any_edge_flag_test()

bool BM_face_is_any_edge_flag_test ( const BMFace f,
const char  hflag 
)

Definition at line 2003 of file bmesh_query.c.

References BM_elem_flag_test, BM_FACE_FIRST_LOOP, BMLoop::e, and BMLoop::next.

Referenced by EDBM_selectmode_convert().

◆ BM_face_is_any_vert_flag_test()

bool BM_face_is_any_vert_flag_test ( const BMFace f,
const char  hflag 
)

Definition at line 1989 of file bmesh_query.c.

References BM_elem_flag_test, BM_FACE_FIRST_LOOP, BMLoop::next, and BMLoop::v.

Referenced by EDBM_selectmode_convert().

◆ BM_face_is_normal_valid()

bool BM_face_is_normal_valid ( const BMFace f)

◆ BM_face_other_edge_loop()

BMLoop* BM_face_other_edge_loop ( BMFace f,
BMEdge e,
BMVert v 
)

Other Loop in Face Sharing an Edge.

Finds the other loop that shares v with e loop in f.

    +----------+
    |          |
    |    f     |
    |          |
    +----------+ <-- return the face loop of this vertex.
    v --> e
    ^     ^ <------- These vert args define direction
                     in the face to check.
                     The faces loop direction is ignored.
Note
caller must ensure e is used in f

Definition at line 26 of file bmesh_query.c.

References BLI_assert, BM_face_edge_share_loop(), BM_loop_other_edge_loop(), e, l, NULL, and v.

◆ BM_face_other_vert_loop()

BMLoop* BM_face_other_vert_loop ( BMFace f,
BMVert v_prev,
BMVert v 
)

Other Loop in Face Sharing a Vertex.

Finds the other loop in a face.

This function returns a loop in f that shares an edge with v The direction is defined by v_prev, where the return value is the loop of what would be 'v_next'

    +----------+ <-- return the face loop of this vertex.
    |          |
    |    f     |
    |          |
    +----------+
    v_prev --> v
    ^^^^^^     ^ <-- These vert args define direction
                     in the face to check.
                     The faces loop direction is ignored.
Note
v_prev and v implicitly define an edge.

Definition at line 39 of file bmesh_query.c.

References BLI_assert, BM_edge_exists(), BM_face_vert_share_loop(), BMLoop::next, NULL, BMLoop::prev, BMLoop::v, and v.

Referenced by BM_edge_calc_rotate(), BM_edge_rotate_check(), BM_edge_rotate_check_degenerate(), BM_loop_other_vert_loop(), bmw_EdgeLoopWalker_step(), and edbm_rip_edge_side_measure().

◆ BM_face_share_edge_check()

bool BM_face_share_edge_check ( BMFace f_a,
BMFace f_b 
)

Returns true if the faces share an edge

Definition at line 984 of file bmesh_query.c.

References BM_edge_in_face(), BM_FACE_FIRST_LOOP, BMLoop::e, and BMLoop::next.

Referenced by BM_face_share_face_check(), BM_face_share_face_count(), bm_isect_tri_tri(), and face_step().

◆ BM_face_share_edge_count()

int BM_face_share_edge_count ( BMFace f_a,
BMFace f_b 
)

Counts the number of edges two faces share (if any)

Definition at line 968 of file bmesh_query.c.

References BM_edge_in_face(), BM_FACE_FIRST_LOOP, count, BMLoop::e, and BMLoop::next.

Referenced by bmesh_kernel_join_face_kill_edge().

◆ BM_face_share_face_check()

bool BM_face_share_face_check ( BMFace f_a,
BMFace f_b 
)

same as BM_face_share_face_count but returns a bool

Definition at line 951 of file bmesh_query.c.

References BM_EDGES_OF_FACE, BM_face_share_edge_check(), BM_FACES_OF_EDGE, BM_ITER_ELEM, and e.

Referenced by hull_merge_triangles().

◆ BM_face_share_face_count()

int BM_face_share_face_count ( BMFace f_a,
BMFace f_b 
)

Returns the number of faces that are adjacent to both f1 and f2,

Note
Could be sped up a bit by not using iterators and by tagging faces on either side, then count the tags rather then searching.

Definition at line 933 of file bmesh_query.c.

References BM_EDGES_OF_FACE, BM_face_share_edge_check(), BM_FACES_OF_EDGE, BM_ITER_ELEM, count, and e.

◆ BM_face_share_vert_check()

bool BM_face_share_vert_check ( BMFace f_a,
BMFace f_b 
)

Returns true if the faces share a vert.

Definition at line 1015 of file bmesh_query.c.

References BM_FACE_FIRST_LOOP, BM_vert_in_face(), BMLoop::next, and BMLoop::v.

◆ BM_face_share_vert_count()

int BM_face_share_vert_count ( BMFace f_a,
BMFace f_b 
)

Counts the number of verts two faces share (if any).

Definition at line 999 of file bmesh_query.c.

References BM_FACE_FIRST_LOOP, BM_vert_in_face(), count, BMLoop::next, and BMLoop::v.

Referenced by bm_face_split_by_edges_island_connect().

◆ BM_face_vert_share_loop()

BMLoop* BM_face_vert_share_loop ( BMFace f,
BMVert v 
)

◆ BM_loop_calc_face_angle()

float BM_loop_calc_face_angle ( const BMLoop l)

Calculates the angle between the previous and next loops (angle at this loops face corner).

Returns
angle in radians

Definition at line 1192 of file bmesh_query.c.

References angle_v3v3v3(), BMVert::co, l, BMLoop::next, BMLoop::prev, and BMLoop::v.

Referenced by BM_mesh_wireframe(), BM_vert_calc_shell_factor(), BM_vert_calc_shell_factor_ex(), bpy_bmloop_calc_angle(), and edbm_average_normals_exec().

◆ BM_loop_calc_face_direction()

void BM_loop_calc_face_direction ( const BMLoop l,
float  r_dir[3] 
)

BM_loop_calc_face_direction.

Calculate the direction a loop is pointing.

Parameters
lThe loop to calculate the direction at
r_dirResulting direction

Definition at line 1284 of file bmesh_query.c.

References add_v3_v3v3(), BMVert::co, l, BMLoop::next, normalize_v3(), BMLoop::prev, sub_v3_v3v3(), and BMLoop::v.

Referenced by get_next_loop().

◆ BM_loop_calc_face_normal()

float BM_loop_calc_face_normal ( const BMLoop l,
float  r_normal[3] 
)

BM_loop_calc_face_normal.

Calculate the normal at this loop corner or fallback to the face normal on straight lines.

Parameters
lThe loop to calculate the normal at
r_normalResulting normal
Returns
The length of the cross product (double the area).

Definition at line 1270 of file bmesh_query.c.

References BMVert::co, copy_v3_v3(), cross_v3_v3v3(), BMLoop::f, l, len, BMLoop::next, BMFace::no, normalize_v3(), BMLoop::prev, sub_v3_v3v3(), UNLIKELY, BMLoop::v, v1, and v2.

Referenced by bpy_bmloop_calc_normal().

◆ BM_loop_calc_face_normal_safe()

float BM_loop_calc_face_normal_safe ( const BMLoop l,
float  r_normal[3] 
)

BM_loop_calc_face_normal_safe_ex with predefined sane epsilon.

Since this doesn't scale based on triangle size, fixed value works well.

Definition at line 1256 of file bmesh_query.c.

References BM_loop_calc_face_normal_safe_ex(), and l.

Referenced by blender::draw::statvis_calc_distort().

◆ BM_loop_calc_face_normal_safe_ex()

float BM_loop_calc_face_normal_safe_ex ( const BMLoop l,
float  epsilon_sq,
float  r_normal[3] 
)

BM_loop_calc_face_normal.

Calculate the normal at this loop corner or fallback to the face normal on straight lines.

Parameters
lThe loop to calculate the normal at.
epsilon_sqValue to avoid numeric errors (1e-5f works well).
r_normalResulting normal.

Definition at line 1197 of file bmesh_query.c.

References BMVert::co, copy_v3_v3(), cross_v3_v3v3(), BMLoop::f, is_zero_v3(), l, len_squared_v3(), mul_v3_v3fl(), BMLoop::next, BMFace::no, normalize_v3(), BMLoop::prev, sub_v3_v3(), sub_v3_v3v3(), BMLoop::v, v1, and v2.

Referenced by BM_loop_calc_face_normal_safe().

◆ BM_loop_calc_face_normal_safe_vcos()

float BM_loop_calc_face_normal_safe_vcos ( const BMLoop l,
const float  normal_fallback[3],
float const (*)  vertexCos[3],
float  r_normal[3] 
)

Definition at line 1261 of file bmesh_query.c.

References BM_loop_calc_face_normal_safe_vcos_ex(), and l.

Referenced by blender::draw::statvis_calc_distort().

◆ BM_loop_calc_face_normal_safe_vcos_ex()

float BM_loop_calc_face_normal_safe_vcos_ex ( const BMLoop l,
const float  normal_fallback[3],
float const (*)  vertexCos[3],
float  epsilon_sq,
float  r_normal[3] 
)

A version of BM_loop_calc_face_normal_safe_ex which takes vertex coordinates.

Definition at line 1226 of file bmesh_query.c.

References BM_elem_index_get, copy_v3_v3(), cross_v3_v3v3(), is_zero_v3(), l, len_squared_v3(), mul_v3_v3fl(), BMLoop::next, normalize_v3(), BMLoop::prev, sub_v3_v3(), sub_v3_v3v3(), BMLoop::v, v1, and v2.

Referenced by BM_loop_calc_face_normal_safe_vcos().

◆ BM_loop_calc_face_tangent()

void BM_loop_calc_face_tangent ( const BMLoop l,
float  r_tangent[3] 
)

BM_loop_calc_face_tangent.

Calculate the tangent at this loop corner or fallback to the face normal on straight lines. This vector always points inward into the face.

Parameters
lThe loop to calculate the tangent at
r_tangentResulting tangent

Definition at line 1299 of file bmesh_query.c.

References add_v3_v3v3(), BMVert::co, compare_v3v3(), cross_v3_v3v3(), dot_v3v3(), BMLoop::f, l, negate_v3(), BMLoop::next, BMFace::no, nor, normalize_v3(), BMLoop::prev, sub_v3_v3v3(), UNLIKELY, and BMLoop::v.

Referenced by BM_mesh_wireframe(), bpy_bmloop_calc_tangent(), and edbm_calc_loop_co().

◆ BM_loop_find_next_nodouble()

BMLoop* BM_loop_find_next_nodouble ( BMLoop l,
BMLoop l_stop,
float  eps_sq 
)
Returns
The next loop, over eps_sq distance from l (or NULL if l_stop is reached).

Definition at line 1163 of file bmesh_query.c.

References BLI_assert, BMVert::co, ELEM, l, len_squared_v3v3(), BMLoop::next, NULL, UNLIKELY, and BMLoop::v.

Referenced by tc_mesh_customdatacorrect_init_vert().

◆ BM_loop_find_prev_nodouble()

BMLoop* BM_loop_find_prev_nodouble ( BMLoop l,
BMLoop l_stop,
float  eps_sq 
)
Returns
The previous loop, over eps_sq distance from l (or NULL if l_stop is reached).

Definition at line 1146 of file bmesh_query.c.

References BLI_assert, BMVert::co, ELEM, l, len_squared_v3v3(), NULL, BMLoop::prev, UNLIKELY, and BMLoop::v.

Referenced by tc_mesh_customdatacorrect_init_vert().

◆ BM_loop_is_convex()

bool BM_loop_is_convex ( const BMLoop l)

Check if the loop is convex or concave (depends on face normal)

Definition at line 1180 of file bmesh_query.c.

References BMVert::co, cross_v3_v3v3(), dot_v3v3(), BMLoop::f, l, BMLoop::next, BMFace::no, BMLoop::prev, sub_v3_v3v3(), and BMLoop::v.

Referenced by bm_face_convex_tag_verts(), and bpy_bmloop_is_convex_get().

◆ BM_loop_other_edge_loop()

BMLoop* BM_loop_other_edge_loop ( BMLoop l,
BMVert v 
)

◆ BM_loop_other_vert_loop()

BMLoop* BM_loop_other_vert_loop ( BMLoop l,
BMVert v 
)

Other Loop in Face Sharing a Vert.

Finds the other loop that shares v with e loop in f.

    +----------+ <-- return the face loop of this vertex.
    |          |
    |          |
    |          |
    +----------+ <-- This vertex defines the direction.
          l    v
          ^ <------- This loop defines both the face to search
                     and the edge, in combination with 'v'
                     The faces loop direction is ignored.

Definition at line 61 of file bmesh_query.c.

References BLI_assert, BM_edge_other_vert(), BM_face_other_vert_loop(), BMLoop::e, e, BMLoop::f, l, BMLoop::next, BMLoop::prev, BMLoop::v, and v.

Referenced by BM_vert_other_disk_edge(), and bmo_inset_region_exec().

◆ BM_loop_other_vert_loop_by_edge()

BMLoop* BM_loop_other_vert_loop_by_edge ( BMLoop l,
BMEdge e 
)

Return the other loop that uses this edge.

In this case the loop defines the vertex, the edge passed in defines the direction to step.

    +----------+ <-- Return the face-loop of this vertex.
    |          |
    |        e | <-- This edge defines the direction.
    |          |
    +----------+ <-- This loop defines the face and vertex..
               l

Definition at line 86 of file bmesh_query.c.

References BLI_assert, BM_vert_in_edge(), BMLoop::e, e, l, BMLoop::next, NULL, BMLoop::prev, and BMLoop::v.

Referenced by BM_edge_uv_share_vert_check().

◆ BM_loop_point_side_of_edge_test()

float BM_loop_point_side_of_edge_test ( const BMLoop l,
const float  co[3] 
)

Check if a point is inside the edge defined by a loop (within the plane defined by the loops edge & face normal).

Returns
signed, squared distance to the edge plane, less than 0.0 when outside.

Definition at line 238 of file bmesh_query.c.

References BMVert::co, cross_v3_v3v3(), dist_signed_squared_to_plane_v3(), dot_v3v3(), BMLoop::f, l, BMLoop::next, BMFace::no, sub_v3_v3v3(), and BMLoop::v.

Referenced by knife_add_single_cut__is_linehit_outside_face().

◆ BM_loop_point_side_of_loop_test()

float BM_loop_point_side_of_loop_test ( const BMLoop l,
const float  co[3] 
)

Check if a point is inside the corner defined by a loop (within the 2 planes defined by the loops corner & face normal).

Returns
signed, squared distance to the loops planes, less than 0.0 when outside.

Definition at line 232 of file bmesh_query.c.

References BMVert::co, dist_signed_squared_to_corner_v3v3v3(), BMLoop::f, l, BMLoop::next, BMFace::no, BMLoop::prev, and BMLoop::v.

Referenced by knife_add_single_cut__is_linehit_outside_face().

◆ bm_loop_region_count__clear()

static int bm_loop_region_count__clear ( BMLoop l)
static

◆ bm_loop_region_count__recursive()

static int bm_loop_region_count__recursive ( BMEdge e,
BMVert v 
)
static

◆ BM_loop_region_loops_count()

int BM_loop_region_loops_count ( BMLoop l)

Definition at line 842 of file bmesh_query.c.

References BM_loop_region_loops_count_at_most(), l, and NULL.

◆ BM_loop_region_loops_count_at_most()

int BM_loop_region_loops_count_at_most ( BMLoop l,
int *  r_loop_total 
)

The number of loops connected to this loop (not including disconnected regions).

Definition at line 829 of file bmesh_query.c.

References bm_loop_region_count__clear(), bm_loop_region_count__recursive(), count, BMLoop::e, l, and BMLoop::v.

Referenced by BM_loop_region_loops_count(), and BM_vert_is_manifold_region().

◆ BM_loop_share_edge_check()

bool BM_loop_share_edge_check ( BMLoop l_a,
BMLoop l_b 
)

Returns true when 2 loops share an edge (are adjacent in the face-fan)

Definition at line 1030 of file bmesh_query.c.

References BLI_assert, BMLoop::e, ELEM, l_b, BMLoop::prev, and BMLoop::v.

Referenced by facetag_add_adjacent(), and facetag_add_adjacent_uv().

◆ BM_mesh_calc_edge_groups()

int BM_mesh_calc_edge_groups ( BMesh bm,
int *  r_groups_array,
int(**)  r_group_index[2],
BMVertFilterFunc  filter_fn,
void user_data,
const char  hflag_test 
)

◆ BM_mesh_calc_edge_groups_as_arrays()

int BM_mesh_calc_edge_groups_as_arrays ( BMesh bm,
BMVert **  verts,
BMEdge **  edges,
BMFace **  faces,
int(**)  r_groups[3] 
)

◆ BM_mesh_calc_face_groups()

int BM_mesh_calc_face_groups ( BMesh bm,
int *  r_groups_array,
int(**)  r_group_index[2],
BMLoopFilterFunc  filter_fn,
BMLoopPairFilterFunc  filter_pair_fn,
void user_data,
const char  hflag_test,
const char  htype_step 
)

◆ BM_mesh_calc_volume()

double BM_mesh_calc_volume ( BMesh bm,
bool  is_signed 
)

◆ bm_mesh_calc_volume_face()

static double bm_mesh_calc_volume_face ( const BMFace f)
static

Use to accumulate volume calculation for faces with consistent winding.

Use double precision since this is prone to float precision error, see T73295.

Definition at line 2047 of file bmesh_query.c.

References BLI_array_alloca, BM_face_calc_tessellation(), BMVert::co, copy_v3db_v3fl(), blender::math::cross(), cross_v3_v3v3_db(), dot_v3v3_db(), BMFace::len, and BMLoop::v.

Referenced by BM_mesh_calc_volume().

◆ BM_vert_calc_edge_angle()

float BM_vert_calc_edge_angle ( const BMVert v)

Definition at line 1415 of file bmesh_query.c.

References BM_vert_calc_edge_angle_ex(), DEG2RADF, and v.

Referenced by bm_vert_edge_face_angle().

◆ BM_vert_calc_edge_angle_ex()

float BM_vert_calc_edge_angle_ex ( const BMVert v,
float  fallback 
)

BMESH VERT/EDGE ANGLE.

Calculates the angle a verts 2 edges.

Returns
the angle in radians

Definition at line 1397 of file bmesh_query.c.

References angle_v3v3v3(), BM_edge_other_vert(), bmesh_disk_edge_next(), BMVert::co, BMVert::e, M_PI, v, v1, and v2.

Referenced by BM_vert_calc_edge_angle(), and bpy_bmvert_calc_edge_angle().

◆ BM_vert_calc_median_tagged_edge_length()

float BM_vert_calc_median_tagged_edge_length ( const BMVert v)
Note
quite an obscure function. used in bmesh operators that have a relative scale options,

Definition at line 1467 of file bmesh_query.c.

References BM_edge_calc_length(), BM_edge_other_vert(), BM_EDGES_OF_VERT, BM_elem_flag_test, BM_ELEM_TAG, BM_ITER_ELEM_INDEX, e, float(), blender::math::length(), and v.

Referenced by BM_mesh_wireframe().

◆ BM_vert_calc_shell_factor()

float BM_vert_calc_shell_factor ( const BMVert v)
Note
this isn't optimal to run on an array of verts, see 'solidify_add_thickness' for a function which runs on an array.

Definition at line 1420 of file bmesh_query.c.

References BM_ITER_ELEM, BM_loop_calc_face_angle(), BM_LOOPS_OF_VERT, BMLoop::f, l, BMVert::no, BMFace::no, shell_v3v3_normalized_to_dist(), and v.

Referenced by BM_vert_calc_shell_factor_ex(), bmo_inset_region_exec(), and bpy_bmvert_calc_shell_factor().

◆ BM_vert_calc_shell_factor_ex()

float BM_vert_calc_shell_factor_ex ( const BMVert v,
const float  no[3],
const char  hflag 
)

◆ BM_vert_edge_count()

int BM_vert_edge_count ( const BMVert v)

Returns the number of edges around this vertex.

Definition at line 607 of file bmesh_query.c.

References bmesh_disk_count(), and v.

Referenced by BKE_mesh_remesh_voxel_fix_poles(), is_vertex_pole(), is_vertex_pole_three(), similar_vert_select_exec(), and unsubdivide_is_all_quads().

◆ BM_vert_edge_count_at_most()

int BM_vert_edge_count_at_most ( const BMVert v,
const int  count_max 
)

Definition at line 612 of file bmesh_query.c.

References bmesh_disk_count_at_most(), and v.

Referenced by BM_vert_dissolve().

◆ BM_vert_edge_count_nonwire()

int BM_vert_edge_count_nonwire ( const BMVert v)

Definition at line 617 of file bmesh_query.c.

References BM_EDGES_OF_VERT, BM_ITER_ELEM, count, and v.

Referenced by bmw_EdgeLoopWalker_begin(), and bmw_EdgeLoopWalker_step().

◆ BM_vert_edge_pair()

bool BM_vert_edge_pair ( BMVert v,
BMEdge **  r_e_a,
BMEdge **  r_e_b 
)

Access a verts 2 connected edges.

Returns
true when only 2 verts are found.

Definition at line 590 of file bmesh_query.c.

References BM_DISK_EDGE_NEXT, BMVert::e, NULL, and v.

Referenced by bm_vert_collapse_is_degenerate(), and getTransformOrientation_ex().

◆ BM_vert_face_check()

bool BM_vert_face_check ( const BMVert v)

Return true if the vertex is connected to any faces.

same as BM_vert_face_count(v) != 0 or BM_vert_find_first_loop(v) == NULL.

Definition at line 674 of file bmesh_query.c.

References bmesh_disk_edge_next(), BMVert::e, BMEdge::l, NULL, and v.

Referenced by bevel_vert_two_edges(), and pbvh_bmesh_collapse_edge().

◆ BM_vert_face_count()

int BM_vert_face_count ( const BMVert v)

Returns the number of faces around this vert length matches BM_LOOPS_OF_VERT iterator

Definition at line 664 of file bmesh_query.c.

References bmesh_disk_facevert_count(), and v.

Referenced by bmo_pointmerge_facedata_exec(), bmw_EdgeLoopWalker_begin(), and similar_vert_select_exec().

◆ BM_vert_face_count_at_most()

int BM_vert_face_count_at_most ( const BMVert v,
int  count_max 
)

Definition at line 669 of file bmesh_query.c.

References bmesh_disk_facevert_count_at_most(), and v.

◆ BM_vert_find_first_loop()

BMLoop* BM_vert_find_first_loop ( BMVert v)

Get the first loop of a vert. Uses the same initialization code for the first loop of the iterator API

Definition at line 297 of file bmesh_query.c.

References bmesh_disk_faceloop_find_first(), BMVert::e, NULL, and v.

Referenced by BM_mesh_partial_create_from_verts_group_multi(), BM_mesh_partial_create_from_verts_group_single(), BM_vert_is_manifold_region(), and edbm_rip_invoke__vert().

◆ BM_vert_find_first_loop_visible()

BMLoop* BM_vert_find_first_loop_visible ( BMVert v)

A version of BM_vert_find_first_loop that ignores hidden loops.

Definition at line 301 of file bmesh_query.c.

References bmesh_disk_faceloop_find_first_visible(), BMVert::e, NULL, and v.

◆ BM_vert_in_face()

bool BM_vert_in_face ( BMVert v,
BMFace f 
)

◆ BM_vert_is_all_edge_flag_test()

bool BM_vert_is_all_edge_flag_test ( const BMVert v,
const char  hflag,
const bool  respect_hide 
)

Definition at line 1914 of file bmesh_query.c.

References BM_EDGES_OF_VERT, BM_elem_flag_test, BM_ELEM_HIDDEN, BM_ITER_ELEM, BMVert::e, and v.

Referenced by EDBM_selectmode_convert().

◆ BM_vert_is_all_face_flag_test()

bool BM_vert_is_all_face_flag_test ( const BMVert v,
const char  hflag,
const bool  respect_hide 
)

Definition at line 1932 of file bmesh_query.c.

References BM_elem_flag_test, BM_ELEM_HIDDEN, BM_FACES_OF_VERT, BM_ITER_ELEM, BMVert::e, and v.

Referenced by EDBM_selectmode_convert().

◆ BM_vert_is_boundary()

bool BM_vert_is_boundary ( const BMVert v)

◆ BM_vert_is_edge_pair()

bool BM_vert_is_edge_pair ( const BMVert v)

◆ BM_vert_is_edge_pair_manifold()

bool BM_vert_is_edge_pair_manifold ( const BMVert v)

Fast alternative to (BM_vert_edge_count(v) == 2) that checks both edges connect to the same faces.

Definition at line 578 of file bmesh_query.c.

References BM_DISK_EDGE_NEXT, BM_edge_is_manifold(), BMVert::e, e, and v.

Referenced by bm_loop_pair_ends(), bm_loop_region_test_chain(), bm_vert_pair_ends(), bm_vert_region_test_chain(), and mesh_calc_path_region_elem().

◆ BM_vert_is_manifold()

bool BM_vert_is_manifold ( const BMVert v)

A vertex is non-manifold if it meets the following conditions: 1: Loose - (has no edges/faces incident upon it). 2: Joins two distinct regions - (two pyramids joined at the tip). 3: Is part of an edge with more than 2 faces. 4: Is part of a wire edge.

Definition at line 705 of file bmesh_query.c.

References BLI_assert, BM_edge_is_boundary(), BM_vert_step_fan_loop(), bmesh_disk_edge_next(), BMVert::e, BMLoop::e, BMEdge::l, BMLoop::next, NULL, BMLoop::radial_next, BMLoop::v, and v.

Referenced by BM_disk_dissolve(), BM_vert_dissolve(), bpy_bmvert_is_manifold_get(), calc_solidify_normals(), and edbm_select_non_manifold_exec().

◆ BM_vert_is_manifold_region()

bool BM_vert_is_manifold_region ( const BMVert v)

A version of BM_vert_is_manifold which only checks if we're connected to multiple isolated regions.

Definition at line 847 of file bmesh_query.c.

References BM_loop_region_loops_count_at_most(), BM_vert_find_first_loop(), count, and v.

Referenced by edbm_rip_invoke__vert().

◆ BM_vert_is_wire()

bool BM_vert_is_wire ( const BMVert v)

Tests whether or not the vertex is part of a wire edge. (ie: has no faces attached to it)

Definition at line 688 of file bmesh_query.c.

References bmesh_disk_edge_next(), BMVert::e, BMEdge::l, and v.

Referenced by bm_vert_connect_select_history(), bpy_bmvert_is_wire_get(), edbm_polybuild_delete_at_cursor_invoke(), edbm_rip_invoke__vert(), and unsubdivide_is_all_quads().

◆ BM_vert_other_disk_edge()

BMEdge* BM_vert_other_disk_edge ( BMVert v,
BMEdge e 
)

The function takes a vertex at the center of a fan and returns the opposite edge in the fan. All edges in the fan must be manifold, otherwise return NULL.

Note
This could (probably) be done more efficiently.

Definition at line 482 of file bmesh_query.c.

References BLI_assert, BM_edge_is_manifold(), BM_loop_other_vert_loop(), BM_vert_in_edge(), BMLoop::e, BMEdge::l, NULL, BMLoop::prev, BMLoop::radial_next, and v.

Referenced by edbm_rip_invoke__edge().

◆ BM_vert_pair_share_face_by_angle()

BMFace* BM_vert_pair_share_face_by_angle ( BMVert v_a,
BMVert v_b,
BMLoop **  r_l_a,
BMLoop **  r_l_b,
bool  allow_adjacent 
)

Given 2 verts, find a face they share that has the lowest angle across these verts and give back both loops.

This can be better than BM_vert_pair_share_face_by_len because concave splits are ranked lowest.

Definition at line 251 of file bmesh_query.c.

References bm_face_calc_split_dot(), BM_face_vert_share_loop(), BM_ITER_ELEM, BM_loop_is_adjacent(), BM_LOOPS_OF_VERT, blender::math::dot(), BMVert::e, BMLoop::f, l_b, and NULL.

Referenced by BM_face_splits_check_optimal().

◆ BM_vert_pair_share_face_by_len()

BMFace* BM_vert_pair_share_face_by_len ( BMVert v_a,
BMVert v_b,
BMLoop **  r_l_a,
BMLoop **  r_l_b,
bool  allow_adjacent 
)

Given 2 verts, find the smallest face they share and give back both loops.

Definition at line 165 of file bmesh_query.c.

References BM_face_vert_share_loop(), BM_ITER_ELEM, BM_loop_is_adjacent(), BM_LOOPS_OF_VERT, BMVert::e, BMLoop::f, l_b, BMFace::len, and NULL.

Referenced by connect_smallest_face().

◆ BM_vert_pair_share_face_check()

bool BM_vert_pair_share_face_check ( BMVert v_a,
BMVert v_b 
)

Check if verts share a face.

Definition at line 100 of file bmesh_query.c.

References BM_FACES_OF_VERT, BM_ITER_ELEM, BM_vert_in_face(), and BMVert::e.

Referenced by BM_mesh_intersect(), BM_mesh_intersect_edges(), BM_vert_splice(), and bpy_bm_utils_vert_splice().

◆ BM_vert_pair_share_face_check_cb()

bool BM_vert_pair_share_face_check_cb ( BMVert v_a,
BMVert v_b,
bool(*)(BMFace *, void *user_data test_fn,
void user_data 
)

Definition at line 116 of file bmesh_query.c.

References BM_FACES_OF_VERT, BM_ITER_ELEM, BM_vert_in_face(), BMVert::e, and user_data.

Referenced by edbm_connect_vert_pair().

◆ BM_vert_pair_shared_face_cb()

BMFace* BM_vert_pair_shared_face_cb ( BMVert v_a,
BMVert v_b,
const bool  allow_adjacent,
bool(*)(BMFace *, BMLoop *, BMLoop *, void *userdata)  callback,
void user_data,
BMLoop **  r_l_a,
BMLoop **  r_l_b 
)

◆ BM_vert_step_fan_loop()

BMLoop* BM_vert_step_fan_loop ( BMLoop l,
BMEdge **  e_step 
)

Utility function to step around a fan of loops, using an edge to mark the previous side.

Note
all edges must be manifold, once a non manifold edge is hit, return NULL.
,.,-->|
_,-' |
,' | (notice how 'e_step'
/ | and 'l' define the
/ | direction the arrow
| return | points).
| loop --> |
---------------------+---------------------
^ l --> |
| |
assign e_step |
|
begin e_step ----> |
|

Definition at line 461 of file bmesh_query.c.

References BLI_assert, BM_edge_is_manifold(), BM_edge_other_loop(), BMLoop::e, l, NULL, and BMLoop::prev.

Referenced by bevel_harden_normals(), bm_edge_collapse_loop_customdata(), BM_loop_check_cyclic_smooth_fan(), bm_mesh_loops_calc_normals_for_loop(), BM_vert_is_manifold(), edbm_average_normals_exec(), and normals_split().

◆ BM_verts_in_face()

bool BM_verts_in_face ( BMVert **  varr,
int  len,
BMFace f 
)

Return true if all verts are in the face.

Definition at line 370 of file bmesh_query.c.

References _FLAG_OVERLAP, BM_ELEM_API_FLAG_DISABLE, BM_ELEM_API_FLAG_ENABLE, BM_ELEM_API_FLAG_TEST, BMFace::l_first, BMFace::len, len, BMLoop::next, and BMLoop::v.

◆ BM_verts_in_face_count()

int BM_verts_in_face_count ( BMVert **  varr,
int  len,
BMFace f 
)

Compares the number of vertices in an array that appear in a given face

Definition at line 330 of file bmesh_query.c.

References _FLAG_OVERLAP, BM_ELEM_API_FLAG_DISABLE, BM_ELEM_API_FLAG_ENABLE, BM_ELEM_API_FLAG_TEST, count, BMFace::l_first, len, BMLoop::next, and BMLoop::v.

Referenced by BM_face_exists_overlap().

◆ bmesh_subd_falloff_calc()

float bmesh_subd_falloff_calc ( const int  falloff,
float  val 
)