Blender
V3.3
|
#include "MEM_guardedalloc.h"
#include "BLI_array.h"
#include "BLI_math.h"
#include "BKE_customdata.h"
#include "bmesh.h"
#include "intern/bmesh_private.h"
Go to the source code of this file.
Functions | |
bool | BM_vert_dissolve (BMesh *bm, BMVert *v) |
Dissolve Vert. More... | |
bool | BM_disk_dissolve (BMesh *bm, BMVert *v) |
BMFace * | BM_faces_join_pair (BMesh *bm, BMLoop *l_a, BMLoop *l_b, const bool do_del) |
Faces Join Pair. More... | |
BMFace * | BM_face_split (BMesh *bm, BMFace *f, BMLoop *l_a, BMLoop *l_b, BMLoop **r_l, BMEdge *example, const bool no_double) |
Face Split. More... | |
BMFace * | BM_face_split_n (BMesh *bm, BMFace *f, BMLoop *l_a, BMLoop *l_b, float cos[][3], int n, BMLoop **r_l, BMEdge *example) |
Face Split with intermediate points. More... | |
BMEdge * | BM_vert_collapse_faces (BMesh *bm, BMEdge *e_kill, BMVert *v_kill, float fac, const bool do_del, const bool join_faces, const bool kill_degenerate_faces, const bool kill_duplicate_faces) |
Vert Collapse Faces. More... | |
BMEdge * | BM_vert_collapse_edge (BMesh *bm, BMEdge *e_kill, BMVert *v_kill, const bool do_del, const bool kill_degenerate_faces, const bool kill_duplicate_faces) |
Vert Collapse Faces. More... | |
BMVert * | BM_edge_collapse (BMesh *bm, BMEdge *e_kill, BMVert *v_kill, const bool do_del, const bool kill_degenerate_faces) |
BMVert * | BM_edge_split (BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float fac) |
Edge Split. More... | |
BMVert * | BM_edge_split_n (BMesh *bm, BMEdge *e, int numcuts, BMVert **r_varr) |
Split an edge multiple times evenly. More... | |
void | BM_edge_verts_swap (BMEdge *e) |
void | BM_edge_calc_rotate (BMEdge *e, const bool ccw, BMLoop **r_l1, BMLoop **r_l2) |
bool | BM_edge_rotate_check (BMEdge *e) |
Check if Rotate Edge is OK. More... | |
bool | BM_edge_rotate_check_degenerate (BMEdge *e, BMLoop *l1, BMLoop *l2) |
Check if Edge Rotate Gives Degenerate Faces. More... | |
bool | BM_edge_rotate_check_beauty (BMEdge *e, BMLoop *l1, BMLoop *l2) |
BMEdge * | BM_edge_rotate (BMesh *bm, BMEdge *e, const bool ccw, const short check_flag) |
Rotate Edge. More... | |
BMVert * | BM_face_loop_separate (BMesh *bm, BMLoop *l_sep) |
Rip a single face from a vertex fan. More... | |
BMVert * | BM_face_loop_separate_multi_isolated (BMesh *bm, BMLoop *l_sep) |
BMVert * | BM_face_loop_separate_multi (BMesh *bm, BMLoop **larr, int larr_len) |
This file contains functions for locally modifying the topology of existing mesh data. (split, join, flip etc).
Definition in file bmesh_mods.c.
dissolves all faces around a vert, and removes it.
Definition at line 51 of file bmesh_mods.c.
References bm, BM_edge_is_boundary(), BM_edge_is_manifold(), BM_edge_share_face_check(), BM_face_split(), BM_face_vert_share_loop(), BM_faces_join_pair(), BM_vert_collapse_faces(), BM_vert_is_manifold(), bmesh_disk_edge_next(), BMVert::e, e, if(), l_b, len, NULL, UNLIKELY, and v.
Referenced by BM_vert_dissolve().
Calculate the 2 loops which would make up the newly rotated Edge but don't actually change anything.
Use this to further inspect if the loops to be connected have issues:
Examples:
Definition at line 635 of file bmesh_mods.c.
References BLI_assert, BM_edge_face_pair(), BM_edge_ordered_verts(), BM_edge_rotate_check(), BM_face_other_vert_loop(), e, fb(), SWAP, v1, and v2.
Referenced by BM_edge_rotate().
BMVert* BM_edge_collapse | ( | BMesh * | bm, |
BMEdge * | e_kill, | ||
BMVert * | v_kill, | ||
bool | do_del, | ||
bool | kill_degenerate_faces | ||
) |
Collapse and edge into a single vertex.
Definition at line 442 of file bmesh_mods.c.
References bm, and bmesh_kernel_join_vert_kill_edge().
Referenced by BKE_mesh_remesh_voxel_fix_poles(), bmo_create_cone_exec(), bmo_extrude_face_region_exec(), bmo_grid_fill_exec(), edbm_polybuild_delete_at_cursor_invoke(), and edbm_polybuild_dissolve_at_cursor_invoke().
Rotate Edge.
Spins an edge topologically, either counter-clockwise or clockwise depending on ccw.
Definition at line 785 of file bmesh_mods.c.
References BMesh::act_face, bm, BM_CREATE_NO_DOUBLE, BM_CREATE_NOP, BM_edge_calc_rotate(), BM_edge_create(), BM_edge_exists(), BM_edge_face_pair(), BM_edge_is_contiguous(), BM_edge_rotate_check(), BM_edge_rotate_check_beauty(), BM_edge_rotate_check_degenerate(), BM_EDGEROT_CHECK_BEAUTY, BM_EDGEROT_CHECK_DEGENERATE, BM_EDGEROT_CHECK_EXISTS, BM_EDGEROT_CHECK_SPLICE, BM_face_edge_share_loop(), BM_face_normal_flip(), BM_face_split(), BM_face_vert_share_loop(), BM_faces_join_pair(), e, BMLoop::f, fb(), BMFace::head, BMHeader::hflag, BMEdge::l, NULL, BMLoop::radial_next, BMLoop::v, v1, and v2.
Referenced by BM_mesh_beautify_fill(), bm_rotate_edges_shared(), bm_rotate_edges_simple(), and bpy_bm_utils_edge_rotate().
Check if Rotate Edge is OK.
Quick check to see if we could rotate the edge, use this to avoid calling exceptions on common cases.
Definition at line 661 of file bmesh_mods.c.
References BM_edge_face_pair(), BM_face_other_vert_loop(), e, fb(), and BMLoop::v.
Referenced by BM_edge_calc_rotate(), BM_edge_rotate(), BM_edge_rotate_check_degenerate(), bm_rotate_edges_shared(), bm_rotate_edges_simple(), and bmo_beautify_fill_exec().
Definition at line 777 of file bmesh_mods.c.
References BMVert::co, e, len_squared_v3v3(), and BMLoop::v.
Referenced by BM_edge_rotate().
Check if Edge Rotate Gives Degenerate Faces.
Check 2 cases 1) does the newly forms edge form a flipped face (compare with previous cross product) 2) does the newly formed edge cause a zero area corner (or close enough to be almost zero)
e | The edge to test rotation. |
l1,l2 | are the loops of the proposed verts to rotate too and should be the result of calling BM_edge_calc_rotate |
Definition at line 690 of file bmesh_mods.c.
References BLI_assert, BM_edge_exists(), BM_edge_ordered_verts(), BM_edge_rotate_check(), BM_face_other_vert_loop(), BMVert::co, cross_v3_v3v3(), dot_v3v3(), e, BMLoop::f, negate_v3_v3(), normalize_v3(), sub_v3_v3v3(), BMLoop::v, v1, and v2.
Referenced by BM_edge_rotate().
Edge Split.
Before: v +-----------------------------------+ e After: v v_new (returned) +-----------------+-----------------+ r_e e
e | The edge to split. |
v | One of the vertices in e and defines the "from" end of the splitting operation, the new vertex will be fac of the way from v to the other end. |
r_e | The newly created edge. |
Definition at line 448 of file bmesh_mods.c.
References _FLAG_OVERLAP, BLI_array_append, BLI_array_free, BLI_array_len, BLI_array_staticdeclare, BLI_assert, bm, BM_data_interp_face_vert_edge(), BM_data_interp_from_verts(), BM_edge_is_wire(), BM_edge_other_vert(), BM_ELEM_API_FLAG_DISABLE, BM_ELEM_API_FLAG_ENABLE, BM_ELEM_API_FLAG_TEST, BM_elem_attrs_copy(), BM_face_calc_center_median(), BM_face_copy(), BM_face_interp_multires_ex(), BM_face_multires_bounds_smooth(), BM_face_verts_kill(), BM_vert_in_edge(), BMESH_ASSERT, bmesh_kernel_split_edge_make_vert(), CD_MDISPS, BMVert::co, CustomData_get_offset(), e, BMLoop::f, BMVert::head, BMEdge::head, BMHeader::hflag, BMEdge::l, l, BMesh::ldata, madd_v3_v3v3fl(), NULL, BMLoop::radial_next, sub_v3_v3v3(), UNLIKELY, and v.
Referenced by BM_edge_split_n(), BM_mesh_bisect_plane(), BM_mesh_intersect(), BM_mesh_intersect_edges(), bm_subdivide_edge_addvert(), bmo_connect_vert_pair_exec(), bmo_dissolve_degenerate_exec(), bmo_offset_edgeloops_exec(), bpy_bm_utils_edge_split(), edbm_face_split_by_edges_exec(), edbm_polybuild_face_at_cursor_invoke(), edbm_polybuild_split_at_cursor_invoke(), edbm_rip_edge_invoke(), and knife_make_cuts().
Split an edge multiple times evenly.
r_varr | Optional array, verts in between (v1 -> v2) |
Definition at line 563 of file bmesh_mods.c.
References bm, BM_edge_split(), e, float(), and NULL.
Referenced by bm_edge_subdiv_as_loop().
Swap v1 & v2
Definition at line 580 of file bmesh_mods.c.
Referenced by bmo_edge_copy().
Rip a single face from a vertex fan.
Definition at line 896 of file bmesh_mods.c.
References bm, and bmesh_kernel_unglue_region_make_vert().
Referenced by bmo_face_inset_individual(), bpy_bm_utils_face_vert_separate(), and bpy_bm_utils_loop_separate().
Definition at line 906 of file bmesh_mods.c.
References bm, and bmesh_kernel_unglue_region_make_vert_multi().
Referenced by BM_mesh_separate_faces(), and edbm_rip_invoke__vert().
Definition at line 901 of file bmesh_mods.c.
References bm, and bmesh_kernel_unglue_region_make_vert_multi_isolated().
Referenced by edbm_rip_invoke__vert().
BMFace* BM_face_split | ( | BMesh * | bm, |
BMFace * | f, | ||
BMLoop * | l_a, | ||
BMLoop * | l_b, | ||
BMLoop ** | r_l, | ||
BMEdge * | example, | ||
bool | no_double | ||
) |
Face Split.
see: bmesh_polygon_edgenet.h for BM_face_split_edgenet
Split a face along two vertices. returns the newly made face, and sets the r_l member to a loop in the newly created edge.
bm | The bmesh |
f | the original face |
l_a,l_b | Loops of this face, their vertices define the split edge to be created (must be differ and not can't be adjacent in the face). |
r_l | pointer which will receive the BMLoop for the split edge in the new face |
example | Edge used for attributes of splitting edge, if non-NULL |
no_double | Use an existing edge if found |
Definition at line 179 of file bmesh_mods.c.
References BLI_assert, bm, BM_face_calc_center_median(), BM_face_copy(), BM_face_interp_multires_ex(), BM_face_kill(), BM_face_multires_bounds_smooth(), BM_loop_is_adjacent(), bmesh_kernel_split_face_make_edge(), CD_MDISPS, CustomData_get_offset(), BMLoop::f, l_b, BMesh::ldata, NULL, and UNLIKELY.
Referenced by bevel_build_trifan(), BM_disk_dissolve(), BM_edge_rotate(), bm_face_bisect_verts(), bm_face_connect_verts(), bm_face_slice(), bm_face_split(), bm_face_split_by_angle(), BM_vert_collapse_faces(), bm_vert_dissolve_fan(), bmo_dissolve_degenerate_exec(), bmo_offset_edgeloops_exec(), bmo_subdivide_edges_exec(), bpy_bm_utils_face_split(), connect_smallest_face(), and remdoubles_splitface().
BMFace* BM_face_split_n | ( | BMesh * | bm, |
BMFace * | f, | ||
BMLoop * | l_a, | ||
BMLoop * | l_b, | ||
float | cos[][3], | ||
int | n, | ||
BMLoop ** | r_l, | ||
BMEdge * | example | ||
) |
Face Split with intermediate points.
Like BM_face_split, but with an edge split by n intermediate points with given coordinates.
bm | The bmesh. |
f | the original face. |
l_a,l_b | Vertices which define the split edge, must be different. |
cos | Array of coordinates for intermediate points. |
n | Length of cos (must be > 0). |
r_l | pointer which will receive the BMLoop. for the first split edge (from l_a) in the new face. |
example | Edge used for attributes of splitting edge, if non-NULL. |
Definition at line 243 of file bmesh_mods.c.
References BLI_assert, bm, BM_face_copy(), BM_face_verts_kill(), BM_loop_interp_from_face(), BM_loop_is_adjacent(), bmesh_kernel_split_edge_make_vert(), bmesh_kernel_split_face_make_edge(), BMVert::co, copy_v3_v3(), KDL::cos(), BMLoop::e, e, BMLoop::f, BMEdge::l, l_b, NULL, BMLoop::radial_next, UNLIKELY, and BMLoop::v.
Referenced by bm_face_split_walk_back(), and bpy_bm_utils_face_split().
Faces Join Pair.
Joins two adjacent faces together.
If the windings do not match the winding of the new face will follow l_a's winding (i.e. l_b will be reversed before the join).
Definition at line 166 of file bmesh_mods.c.
References BLI_assert, bm, BM_faces_join(), bmesh_kernel_loop_reverse(), CD_MDISPS, CustomData_get_offset(), BMLoop::e, BMLoop::f, faces, l_b, BMesh::ldata, and BMLoop::v.
Referenced by BM_disk_dissolve(), BM_edge_rotate(), BM_mesh_decimate_dissolve_ex(), bmo_dissolve_edges_exec(), bmo_dissolve_verts_exec(), bmo_join_triangles_exec(), bmo_triangle_fill_exec(), and edbm_polybuild_dissolve_at_cursor_invoke().
BMEdge* BM_vert_collapse_edge | ( | BMesh * | bm, |
BMEdge * | e_kill, | ||
BMVert * | v_kill, | ||
bool | do_del, | ||
bool | kill_degenerate_faces, | ||
bool | kill_duplicate_faces | ||
) |
Vert Collapse Faces.
Collapses a vertex onto another vertex it shares an edge with.
Definition at line 402 of file bmesh_mods.c.
References bm, BM_edge_other_vert(), BM_vert_collapse_faces(), bmesh_disk_edge_next(), bmesh_kernel_join_edge_kill_vert(), and NULL.
Referenced by BM_mesh_decimate_dissolve_ex(), BM_mesh_intersect(), BM_vert_dissolve(), bm_vert_dissolve_fan(), bmo_dissolve_edges_exec(), bmo_dissolve_faces_exec(), bmo_dissolve_verts_exec(), and bpy_bm_utils_vert_collapse_edge().
BMEdge* BM_vert_collapse_faces | ( | BMesh * | bm, |
BMEdge * | e_kill, | ||
BMVert * | v_kill, | ||
float | fac, | ||
bool | do_del, | ||
bool | join_faces, | ||
bool | kill_degenerate_faces, | ||
bool | kill_duplicate_faces | ||
) |
Vert Collapse Faces.
Collapses vertex v_kill that has only two manifold edges onto a vertex it shares an edge with. fac defines the amount of interpolation for Custom Data.
bm | The bmesh |
e_kill | The edge to collapse |
v_kill | The vertex to collapse into the edge |
fac | The factor along the edge |
join_faces | When true the faces around the vertex will be joined otherwise collapse the vertex by merging the 2 edges this vert touches into one. |
kill_degenerate_faces | Removes faces with less than 3 verts after collapsing. |
Definition at line 316 of file bmesh_mods.c.
References BLI_array_append, BLI_array_free, BLI_array_len, BLI_array_staticdeclare, BLI_assert, bm, BM_data_interp_from_verts(), BM_DEFAULT_ITER_STACK_SIZE, BM_edge_other_vert(), BM_face_split(), BM_face_vert_share_loop(), BM_faces_join(), BM_FACES_OF_VERT, BM_ITER_ELEM, bmesh_disk_count(), bmesh_disk_edge_next(), bmesh_kernel_join_edge_kill_vert(), CustomData_bmesh_interp(), BMHeader::data, BMLoop::e, faces, BMLoop::head, BMEdge::l, l_b, BMesh::ldata, BMLoop::next, NULL, BMLoop::radial_next, src, BMLoop::v, and w().
Referenced by BM_disk_dissolve(), BM_vert_collapse_edge(), and bpy_bm_utils_vert_collapse_faces().
Dissolve Vert.
Turns the face region surrounding a manifold vertex into a single polygon.
+---------+ +---------+ | \ / | | | Before: | v | After: | | | / \ | | | +---------+ +---------+
This function can also collapse edges too in cases when it can't merge into faces.
Before: +----v----+ After: +---------+
Definition at line 20 of file bmesh_mods.c.
References bm, BM_disk_dissolve(), BM_vert_collapse_edge(), BM_vert_edge_count_at_most(), BM_vert_face_count_is_equal, BM_vert_is_manifold(), BM_vert_kill(), BMVert::e, BMEdge::l, len, NULL, and v.
Referenced by bm_vert_dissolve_fan(), and bpy_bm_utils_vert_dissolve().