|
Blender
V2.93
|
#include "DNA_listBase.h"#include "DNA_meshdata_types.h"#include "DNA_modifier_types.h"#include "MEM_guardedalloc.h"#include "BLI_alloca.h"#include "BLI_heap.h"#include "BLI_linklist.h"#include "BLI_math.h"#include "BLI_memarena.h"#include "BLI_polyfill_2d.h"#include "BLI_polyfill_2d_beautify.h"#include "bmesh.h"#include "bmesh_tools.h"#include "BKE_customdata.h"#include "intern/bmesh_private.h"Go to the source code of this file.
Macros | |
| #define | EDGE_SHARE_VERT(e1, e2) ((ELEM((e1)[0], (e2)[0], (e2)[1])) || (ELEM((e1)[1], (e2)[0], (e2)[1]))) |
| #define | USE_TESSFACE_SPEEDUP |
Functions | |
| static float | bm_face_calc_poly_normal (const BMFace *f, float n[3]) |
| COMPUTE POLY NORMAL (BMFace) More... | |
| static float | bm_face_calc_poly_normal_vertex_cos (const BMFace *f, float r_no[3], float const (*vertexCos)[3]) |
| COMPUTE POLY NORMAL (BMFace) More... | |
| static void | bm_face_calc_poly_center_median_vertex_cos (const BMFace *f, float r_cent[3], float const (*vertexCos)[3]) |
| COMPUTE POLY CENTER (BMFace) More... | |
| void | BM_face_calc_tessellation (const BMFace *f, const bool use_fixed_quad, BMLoop **r_loops, uint(*r_index)[3]) |
| void | BM_face_calc_point_in_face (const BMFace *f, float r_co[3]) |
| float | BM_face_calc_area (const BMFace *f) |
| float | BM_face_calc_area_with_mat3 (const BMFace *f, const float mat3[3][3]) |
| float | BM_face_calc_area_uv (const BMFace *f, int cd_loop_uv_offset) |
| float | BM_face_calc_perimeter (const BMFace *f) |
| float | BM_face_calc_perimeter_with_mat3 (const BMFace *f, const float mat3[3][3]) |
| static int | bm_vert_tri_find_unique_edge (BMVert *verts[3]) |
| void | BM_vert_tri_calc_tangent_edge (BMVert *verts[3], float r_tangent[3]) |
| void | BM_vert_tri_calc_tangent_edge_pair (BMVert *verts[3], float r_tangent[3]) |
| void | BM_face_calc_tangent_edge (const BMFace *f, float r_tangent[3]) |
| void | BM_face_calc_tangent_edge_pair (const BMFace *f, float r_tangent[3]) |
| void | BM_face_calc_tangent_edge_diagonal (const BMFace *f, float r_tangent[3]) |
| void | BM_face_calc_tangent_vert_diagonal (const BMFace *f, float r_tangent[3]) |
| void | BM_face_calc_tangent_auto (const BMFace *f, float r_tangent[3]) |
| void | BM_face_calc_bounds_expand (const BMFace *f, float min[3], float max[3]) |
| void | BM_face_calc_center_bounds (const BMFace *f, float r_cent[3]) |
| void | BM_face_calc_center_bounds_vcos (const BMesh *bm, const BMFace *f, float r_cent[3], float const (*vertexCos)[3]) |
| void | BM_face_calc_center_median (const BMFace *f, float r_cent[3]) |
| void | BM_face_calc_center_median_weighted (const BMFace *f, float r_cent[3]) |
| void | poly_rotate_plane (const float normal[3], float(*verts)[3], const uint nverts) |
| POLY ROTATE PLANE. More... | |
| void | BM_edge_normals_update (BMEdge *e) |
| static void | bm_loop_normal_accum (const BMLoop *l, float no[3]) |
| bool | BM_vert_calc_normal_ex (const BMVert *v, const char hflag, float r_no[3]) |
| bool | BM_vert_calc_normal (const BMVert *v, float r_no[3]) |
| void | BM_vert_normal_update_all (BMVert *v) |
| void | BM_vert_normal_update (BMVert *v) |
| float | BM_face_calc_normal (const BMFace *f, float r_no[3]) |
| BMESH UPDATE FACE NORMAL. More... | |
| void | BM_face_normal_update (BMFace *f) |
| float | BM_face_calc_normal_vcos (const BMesh *bm, const BMFace *f, float r_no[3], float const (*vertexCos)[3]) |
| void | BM_verts_calc_normal_from_cloud_ex (BMVert **varr, int varr_len, float r_normal[3], float r_center[3], int *r_index_tangent) |
| void | BM_verts_calc_normal_from_cloud (BMVert **varr, int varr_len, float r_normal[3]) |
| float | BM_face_calc_normal_subset (const BMLoop *l_first, const BMLoop *l_last, float r_no[3]) |
| void | BM_face_calc_center_median_vcos (const BMesh *bm, const BMFace *f, float r_cent[3], float const (*vertexCos)[3]) |
| void | BM_face_normal_flip_ex (BMesh *bm, BMFace *f, const int cd_loop_mdisp_offset, const bool use_loop_mdisp_flip) |
| Face Flip Normal. More... | |
| void | BM_face_normal_flip (BMesh *bm, BMFace *f) |
| bool | BM_face_point_inside_test (const BMFace *f, const float co[3]) |
| void | BM_face_triangulate (BMesh *bm, BMFace *f, BMFace **r_faces_new, int *r_faces_new_tot, BMEdge **r_edges_new, int *r_edges_new_tot, LinkNode **r_faces_double, const int quad_method, const int ngon_method, const bool use_tag, MemArena *pf_arena, struct Heap *pf_heap) |
| BMESH TRIANGULATE FACE. More... | |
| void | BM_face_splits_check_legal (BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int len) |
| void | BM_face_splits_check_optimal (BMFace *f, BMLoop *(*loops)[2], int len) |
| void | BM_face_as_array_vert_tri (BMFace *f, BMVert *r_verts[3]) |
| void | BM_face_as_array_vert_quad (BMFace *f, BMVert *r_verts[4]) |
| void | BM_face_as_array_loop_tri (BMFace *f, BMLoop *r_loops[3]) |
| void | BM_face_as_array_loop_quad (BMFace *f, BMLoop *r_loops[4]) |
| void | BM_mesh_calc_tessellation (BMesh *bm, BMLoop *(*looptris)[3], int *r_looptris_tot) |
| BM_mesh_calc_tessellation get the looptris and its number from a certain bmesh. More... | |
| void | BM_mesh_calc_tessellation_beauty (BMesh *bm, BMLoop *(*looptris)[3], int *r_looptris_tot) |
This file contains code for dealing with polygons (normal/area calculation, tessellation, etc)
Definition in file bmesh_polygon.c.
| #define EDGE_SHARE_VERT | ( | e1, | |
| e2 | |||
| ) | ((ELEM((e1)[0], (e2)[0], (e2)[1])) || (ELEM((e1)[1], (e2)[0], (e2)[1]))) |
| #define USE_TESSFACE_SPEEDUP |
| void BM_edge_normals_update | ( | BMEdge * | e | ) |
updates face and vertex normals incident on an edge
Definition at line 691 of file bmesh_polygon.c.
References BM_face_normal_update(), BM_FACES_OF_EDGE, BM_ITER_ELEM, BM_vert_normal_update(), and e.
Referenced by bpy_bmedge_normal_update().
faster alternative to: BM_iter_as_array(bm, BM_LOOPS_OF_FACE, f, (void **)l, 4);
Definition at line 1512 of file bmesh_polygon.c.
References BLI_assert, BM_FACE_FIRST_LOOP, l, BMFace::len, and BMLoop::next.
Referenced by bm_grid_fill_array().
Small utility functions for fast access
faster alternative to: BM_iter_as_array(bm, BM_LOOPS_OF_FACE, f, (void **)l, 3);
Definition at line 1495 of file bmesh_polygon.c.
References BLI_assert, BM_FACE_FIRST_LOOP, l, BMFace::len, and BMLoop::next.
faster alternative to: BM_iter_as_array(bm, BM_VERTS_OF_FACE, f, (void **)v, 4);
Definition at line 1474 of file bmesh_polygon.c.
References BLI_assert, BM_FACE_FIRST_LOOP, l, BMFace::len, BMLoop::next, and BMLoop::v.
Referenced by BM_face_calc_tangent_edge_pair(), and skin_fix_hole_no_good_verts().
Small utility functions for fast access
faster alternative to: BM_iter_as_array(bm, BM_VERTS_OF_FACE, f, (void **)v, 3);
Definition at line 1457 of file bmesh_polygon.c.
References BLI_assert, BM_FACE_FIRST_LOOP, l, BMFace::len, BMLoop::next, and BMLoop::v.
Referenced by BKE_pbvh_bmesh_node_raycast_detail(), BM_face_calc_tangent_auto(), BM_face_calc_tangent_edge_pair(), bm_log_face_alloc(), edge_queue_tri_in_circle(), edge_queue_tri_in_sphere(), GPU_pbvh_bmesh_buffers_update(), pbvh_bmesh_collapse_edge(), pbvh_bmesh_node_nearest_to_ray(), pbvh_bmesh_node_raycast(), and quad_from_tris().
get the area of the face
Definition at line 225 of file bmesh_polygon.c.
References add_newell_cross_v3_v3v3(), BM_FACE_FIRST_LOOP, BMVert::co, len_v3(), BMLoop::next, BMLoop::v, and zero_v3().
Referenced by bpy_bmface_calc_area(), edbm_average_normals_exec(), EDBM_select_interior_faces(), hull_merge_triangles(), mesh_edituv_stretch_area_finish(), recalc_face_normals_find_index(), and smart_project_exec().
get the area of UV face
Definition at line 264 of file bmesh_polygon.c.
References BM_ELEM_CD_GET_VOID_P, BM_FACE_FIRST_LOOP, cross(), fabsf, BMLoop::next, and MLoopUV::uv.
Referenced by mesh_edituv_stretch_area_finish().
Get the area of the face in world space.
Definition at line 242 of file bmesh_polygon.c.
References add_newell_cross_v3_v3v3(), BM_FACE_FIRST_LOOP, BMVert::co, copy_v3_v3(), len_v3(), mul_v3_m3v3(), BMLoop::next, BMLoop::v, and zero_v3().
Referenced by similar_face_select_exec().
expands bounds (min/max must be initialized).
Definition at line 571 of file bmesh_polygon.c.
References BM_FACE_FIRST_LOOP, BMVert::co, max, min, minmax_v3v3_v3(), BMLoop::next, and BMLoop::v.
Referenced by uv_map_transform_calc_bounds().
computes center of face in 3d. uses center of bounding box.
Definition at line 583 of file bmesh_polygon.c.
References BM_FACE_FIRST_LOOP, BMVert::co, INIT_MINMAX, max, mid_v3_v3v3(), min, minmax_v3v3_v3(), BMLoop::next, and BMLoop::v.
Referenced by bmo_poke_exec(), bpy_bmface_calc_center_bounds(), choose_rep_face(), and DRW_text_edit_mesh_measure_stats().
| void BM_face_calc_center_bounds_vcos | ( | const BMesh * | bm, |
| const BMFace * | f, | ||
| float | r_cent[3], | ||
| float const (*) | vertexCos[3] | ||
| ) |
computes center of face in 3d. uses center of bounding box.
Definition at line 601 of file bmesh_polygon.c.
References BLI_assert, bm, BM_elem_index_get, BM_FACE_FIRST_LOOP, BM_VERT, BMesh::elem_index_dirty, INIT_MINMAX, max, mid_v3_v3v3(), min, minmax_v3v3_v3(), BMLoop::next, and BMLoop::v.
Referenced by DRW_text_edit_mesh_measure_stats().
computes the center of a face, using the mean average
Definition at line 626 of file bmesh_polygon.c.
References add_v3_v3(), BM_FACE_FIRST_LOOP, BMVert::co, BMFace::len, mul_v3_fl(), BMLoop::next, BMLoop::v, and zero_v3().
Referenced by BKE_editmesh_cache_ensure_poly_centers(), bm_decim_build_quadrics(), BM_edge_split(), BM_editselection_center(), BM_face_interp_multires(), BM_face_split(), BM_face_triangulate(), BM_faces_join(), BM_loop_interp_multires(), bmo_poke_exec(), bpy_bmface_calc_center_mean(), compute_mdisp_quad(), DRW_text_edit_mesh_measure_stats(), EDBM_unified_findnearest_from_raycast(), mesh_customdatacorrect_apply_vert(), mouse_mesh_loop(), skin_hole_target_face(), sort_bmelem_flag(), and uv_map_transform_calc_center_median().
| void BM_face_calc_center_median_vcos | ( | const BMesh * | bm, |
| const BMFace * | f, | ||
| float | r_cent[3], | ||
| float const (*) | vertexCos[3] | ||
| ) |
Definition at line 1019 of file bmesh_polygon.c.
References BLI_assert, bm, bm_face_calc_poly_center_median_vertex_cos(), BM_VERT, and BMesh::elem_index_dirty.
Referenced by BKE_editmesh_cache_ensure_poly_centers(), DRW_text_edit_mesh_measure_stats(), and EDBM_unified_findnearest_from_raycast().
computes the center of a face, using the mean average weighted by edge length
Definition at line 643 of file bmesh_polygon.c.
References BM_edge_calc_length(), BM_FACE_FIRST_LOOP, BMVert::co, BMLoop::e, madd_v3_v3fl(), mul_v3_fl(), BMLoop::next, BMLoop::prev, BMLoop::v, w(), and zero_v3().
Referenced by bmo_planar_faces_exec(), bmo_poke_exec(), bpy_bmface_calc_center_median_weighted(), edgetag_cut_cost_face(), facetag_cut_cost_edge(), facetag_cut_cost_vert(), and recalc_face_normals_find_index().
BMESH UPDATE FACE NORMAL.
Updates the stored normal for the given face. Requires that a buffer of sufficient length to store projected coordinates for all of the face's vertices is passed in as well.
Definition at line 822 of file bmesh_polygon.c.
References bm_face_calc_poly_normal(), BM_FACE_FIRST_LOOP, BMVert::co, l, BMFace::len, BMLoop::next, normal_quad_v3(), normal_tri_v3(), and v.
Referenced by BM_face_is_normal_valid(), and BM_face_normal_update().
Calculates the face subset normal.
Definition at line 998 of file bmesh_polygon.c.
References add_newell_cross_v3_v3v3(), BMVert::co, BMLoop::next, normalize_v3(), BMLoop::v, and zero_v3().
Referenced by bm_face_calc_split_dot(), and bm_face_split_find().
| float BM_face_calc_normal_vcos | ( | const BMesh * | bm, |
| const BMFace * | f, | ||
| float | r_no[3], | ||
| float const (*) | vertexCos[3] | ||
| ) |
Definition at line 854 of file bmesh_polygon.c.
References BLI_assert, bm, BM_elem_index_get, bm_face_calc_poly_normal_vertex_cos(), BM_FACE_FIRST_LOOP, BM_VERT, BMesh::elem_index_dirty, l, BMFace::len, BMLoop::next, normal_quad_v3(), normal_tri_v3(), and v.
Referenced by BKE_editmesh_cache_ensure_poly_normals().
compute the perimeter of an ngon
Definition at line 283 of file bmesh_polygon.c.
References BM_FACE_FIRST_LOOP, BMVert::co, len_v3v3(), BMLoop::next, and BMLoop::v.
Referenced by bpy_bmface_calc_perimeter().
Calculate the perimeter of a ngon in world space.
Definition at line 299 of file bmesh_polygon.c.
References BM_FACE_FIRST_LOOP, BMVert::co, copy_v3_v3(), len_v3v3(), mul_v3_m3v3(), BMLoop::next, and BMLoop::v.
Referenced by similar_face_select_exec().
Return a point inside the face.
Definition at line 184 of file bmesh_polygon.c.
References blender::compositor::area(), area_squared_tri_v3(), ARRAY_SET_ITEMS, BLI_array_alloca, BM_face_calc_tessellation(), BM_FACE_FIRST_LOOP, BMVert::co, l, BMFace::len, mid_v3_v3v3v3(), BMLoop::next, BMLoop::prev, BMLoop::v, and v.
Referenced by BM_mesh_intersect(), and EDBM_mesh_knife().
|
static |
COMPUTE POLY CENTER (BMFace)
Definition at line 105 of file bmesh_polygon.c.
References add_v3_v3(), BM_elem_index_get, BM_FACE_FIRST_LOOP, BMFace::len, mul_v3_fl(), BMLoop::next, BMLoop::v, and zero_v3().
Referenced by BM_face_calc_center_median_vcos().
COMPUTE POLY NORMAL (BMFace)
Same as normal_poly_v3 but operates directly on a bmesh face.
Definition at line 51 of file bmesh_polygon.c.
References add_newell_cross_v3_v3v3(), BM_FACE_FIRST_LOOP, BMVert::co, BMLoop::next, normalize_v3(), BMLoop::prev, BMLoop::v, and zero_v3().
Referenced by BM_face_calc_normal().
|
static |
COMPUTE POLY NORMAL (BMFace)
Same as bm_face_calc_poly_normal but takes an array of vertex locations.
Definition at line 79 of file bmesh_polygon.c.
References add_newell_cross_v3_v3v3(), BM_elem_index_get, BM_FACE_FIRST_LOOP, BMLoop::next, normalize_v3(), BMLoop::prev, BMLoop::v, and zero_v3().
Referenced by BM_face_calc_normal_vcos().
Compute a meaningful direction along the face (use for gizmo axis).
Definition at line 550 of file bmesh_polygon.c.
References BM_face_as_array_vert_tri(), BM_face_calc_tangent_edge(), BM_face_calc_tangent_edge_pair(), BM_vert_tri_calc_tangent_edge(), BMFace::len, and verts.
Referenced by BM_loop_interp_from_face(), and getTransformOrientation_ex().
Compute the tangent of the face, using the longest edge.
Definition at line 401 of file bmesh_polygon.c.
References BM_face_find_longest_loop(), BMVert::co, BMLoop::next, normalize_v3(), sub_v3_v3v3(), and BMLoop::v.
Referenced by BM_face_calc_tangent_auto(), and bpy_bmface_calc_tangent_edge().
Compute the tangent of the face, using the edge farthest away from any vertex in the face.
| r_tangent | Calculated unit length tangent (return value). |
Definition at line 480 of file bmesh_polygon.c.
References BLI_assert, BM_FACE_FIRST_LOOP, closest_to_line_segment_v3(), BMVert::co, copy_v3_v3(), ELEM, len_squared_v3(), BMLoop::next, normalize_v3(), BMLoop::prev, sub_v3_v3v3(), BMLoop::v, and zero_v3().
Referenced by bpy_bmface_calc_tangent_edge_diagonal().
Compute the tangent of the face, using the two longest disconnected edges.
| r_tangent | Calculated unit length tangent (return value). |
Definition at line 415 of file bmesh_polygon.c.
References add_v3_v3v3(), BM_face_as_array_vert_quad(), BM_face_as_array_vert_tri(), BM_face_find_longest_loop(), BM_vert_tri_calc_tangent_edge_pair(), BMVert::co, copy_v3_v3(), BMFace::len, len_squared_v3(), len_squared_v3v3(), BMLoop::next, normalize_v3(), normalize_v3_v3(), NULL, BMLoop::prev, sub_v3_v3v3(), UNLIKELY, BMLoop::v, and verts.
Referenced by BM_face_calc_tangent_auto(), and bpy_bmface_calc_tangent_edge_pair().
Compute the tangent of the face, using longest distance between vertices on the face.
Definition at line 517 of file bmesh_polygon.c.
References BM_FACE_FIRST_LOOP, BMVert::co, copy_v3_v3(), len_squared_v3(), BMLoop::next, normalize_v3(), sub_v3_v3v3(), BMLoop::v, and zero_v3().
Referenced by bpy_bmface_calc_tangent_vert_diagonal().
| void BM_face_calc_tessellation | ( | const BMFace * | f, |
| const bool | use_fixed_quad, | ||
| BMLoop ** | r_loops, | ||
| uint(*) | r_index[3] | ||
| ) |
For tools that insist on using triangles, ideally we would cache this data.
| use_fixed_quad | When true, always split quad along (0 -> 2) regardless of concave corners, (as done in BM_mesh_calc_tessellation). |
| r_loops | Store face loop pointers, (f->len) |
| r_index | Store triangle triples, indices into r_loops, ((f->len - 2) * 3) |
Definition at line 130 of file bmesh_polygon.c.
References axis_dominant_v3_to_m3_negate(), BLI_array_alloca, BLI_polyfill_calc(), BM_FACE_FIRST_LOOP, BMVert::co, float(), BMFace::len, mul_v2_m3v3(), BMLoop::next, BMFace::no, and BMLoop::v.
Referenced by BM_face_calc_point_in_face(), and bm_mesh_calc_volume_face().
Definition at line 1046 of file bmesh_polygon.c.
References bm, BM_face_normal_flip_ex(), CD_MDISPS, CustomData_get_offset(), and BMesh::ldata.
Referenced by BM_edge_rotate(), bm_face_copy_shared_all(), BM_mesh_intersect(), bmo_extrude_face_region_exec(), bmo_recalc_face_normals_array(), bpy_bm_utils_face_flip(), and bpy_bmface_normal_flip().
| void BM_face_normal_flip_ex | ( | BMesh * | bm, |
| BMFace * | f, | ||
| const int | cd_loop_mdisp_offset, | ||
| const bool | use_loop_mdisp_flip | ||
| ) |
Reverses the winding of a face.
Definition at line 1037 of file bmesh_polygon.c.
References bm, bmesh_kernel_loop_reverse(), negate_v3(), and BMFace::no.
Referenced by BM_face_normal_flip(), BMD_mesh_bm_create(), and bmo_reverse_faces_exec().
| void BM_face_normal_update | ( | BMFace * | f | ) |
Definition at line 848 of file bmesh_polygon.c.
References BM_face_calc_normal(), and BMFace::no.
Referenced by add_poly(), BM_edge_normals_update(), bm_face_triangulate(), BM_mesh_bm_from_me(), BM_mesh_calc_uvs_cone(), BM_mesh_decimate_dissolve_ex(), BM_mesh_intersect_edges(), BM_vert_normal_update_all(), bmo_connect_verts_nonplanar_exec(), bmo_edgenet_fill_exec(), bmo_holes_fill_exec(), bmo_planar_faces_exec(), bpy_bmface_normal_update(), bridge_loop_pair(), build_hull(), mesh_faces_calc_normals_cb(), pbvh_bmesh_normals_update(), skin_smooth_hulls(), and vert_face_normal_mark_update().
BM POINT IN FACE
Projects co onto face f, and returns true if it is inside the face bounds.
Definition at line 1062 of file bmesh_polygon.c.
References axis_dominant_v3_to_m3(), BLI_array_alloca, BLI_assert, BM_FACE_FIRST_LOOP, BM_face_is_normal_valid(), BMVert::co, float(), isect_point_poly_v2(), BMFace::len, mul_v2_m3v3(), BMLoop::next, BMFace::no, and BMLoop::v.
Referenced by bm_vert_pair_share_best_splittable_face_cb(), bpy_bm_geometry_intersect_face_point(), and knife_verts_edge_in_face().
each pair of loops defines a new edge, a split. this function goes through and sets pairs that are geometrically invalid to null. a split is invalid, if it forms a concave angle or it intersects other edges in the face, or it intersects another split. in the case of intersecting splits, only the first of the set of intersecting splits survives
Definition at line 1337 of file bmesh_polygon.c.
References add_v2_fl(), add_v2_v2(), axis_dominant_v3_to_m3(), BLI_array_alloca, BLI_assert, bm, BM_elem_index_get, BM_elem_index_set, BM_FACE_FIRST_LOOP, BM_face_is_normal_valid(), BM_LOOP, center, BMVert::co, EDGE_SHARE_VERT, BMesh::elem_index_dirty, float(), is_poly_convex_v2(), ISECT_LINE_LINE_CROSS, isect_seg_seg_v2(), l, BMFace::len, len, max_ff(), mid_v2_v2v2(), mul_v2_fl(), mul_v2_m3v3(), BMLoop::next, BMFace::no, NULL, sub_v2_v2(), UNPACK2, and BMLoop::v.
Referenced by bm_face_connect_verts(), and bm_face_split_find().
This simply checks that the verts don't connect faces which would have more optimal splits. but not check for correctness.
Definition at line 1438 of file bmesh_polygon.c.
References BM_vert_pair_share_face_by_angle(), len, NULL, and v.
Referenced by bm_face_connect_verts().
| void BM_face_triangulate | ( | BMesh * | bm, |
| BMFace * | f, | ||
| BMFace ** | r_faces_new, | ||
| int * | r_faces_new_tot, | ||
| BMEdge ** | r_edges_new, | ||
| int * | r_edges_new_tot, | ||
| LinkNode ** | r_faces_double, | ||
| const int | quad_method, | ||
| const int | ngon_method, | ||
| const bool | use_tag, | ||
| MemArena * | pf_arena, | ||
| struct Heap * | pf_heap | ||
| ) |
BMESH TRIANGULATE FACE.
Breaks all quads and ngons down to triangles. It uses polyfill for the ngons splitting, and the beautify operator when use_beauty is true.
| r_faces_new | if non-null, must be an array of BMFace pointers, with a length equal to (f->len - 3). It will be filled with the new triangles (not including the original triangle). |
| r_faces_double | When newly created faces are duplicates of existing faces, they're added to this list. Caller must handle de-duplication. This is done because its possible all faces exist already, and in that case we would have to remove all faces including the one passed, which causes complications adding/removing faces while looking over them. |
Definition at line 1107 of file bmesh_polygon.c.
References ARRAY_SET_ITEMS, axis_dominant_v3_to_m3_negate(), BLI_array_alloca, BLI_assert, BLI_linklist_prepend(), BLI_memarena_clear(), BLI_polyfill_beautify(), BLI_polyfill_calc_arena(), bm, BM_CREATE_NOP, BM_elem_attrs_copy(), BM_elem_flag_enable, BM_ELEM_TAG, BM_FACE, BM_face_calc_center_median(), BM_face_create_verts(), BM_FACE_FIRST_LOOP, BM_face_interp_multires_ex(), BM_face_is_normal_valid(), BM_face_kill(), BM_verts_calc_rotate_beauty(), bmesh_face_swap_data(), CD_MDISPS, BMVert::co, CustomData_get_offset(), BMLoop::e, e, BMesh::elem_index_dirty, BMLoop::f, float(), is_quad_flip_v3(), BMesh::ldata, BMFace::len, len_squared_v3v3(), MOD_TRIANGULATE_NGON_BEAUTY, MOD_TRIANGULATE_QUAD_ALTERNATE, MOD_TRIANGULATE_QUAD_BEAUTY, MOD_TRIANGULATE_QUAD_FIXED, MOD_TRIANGULATE_QUAD_SHORTEDGE, mul_v2_m3v3(), BMLoop::next, BMFace::no, NULL, BMLoop::prev, BMLoop::radial_next, UNLIKELY, and BMLoop::v.
Referenced by bm_face_split_by_concave(), bm_face_triangulate(), bm_face_triangulate_mapping(), and BM_mesh_triangulate().
Definition at line 704 of file bmesh_polygon.c.
References BMVert::co, dot_v3v3(), BMLoop::f, l, madd_v3_v3fl(), BMLoop::next, BMFace::no, normalize_v3(), BMLoop::prev, saacos(), sub_v3_v3v3(), and BMLoop::v.
Referenced by BM_vert_calc_normal(), BM_vert_calc_normal_ex(), and BM_vert_normal_update_all().
BM_mesh_calc_tessellation get the looptris and its number from a certain bmesh.
| looptris |
Definition at line 1533 of file bmesh_polygon.c.
References axis_dominant_v3_to_m3_negate(), BLI_array_grow_items, BLI_assert, BLI_memarena_alloc(), BLI_memarena_clear(), BLI_memarena_free(), BLI_memarena_new(), BLI_MEMARENA_STD_BUFSIZE, BLI_polyfill_calc_arena(), bm, BM_FACE_FIRST_LOOP, BM_FACES_OF_MESH, BM_ITER_ELEM_INDEX, BM_ITER_MESH, BM_LOOPS_OF_FACE, BMVert::co, float(), is_quad_flip_v3_first_third_fast(), l, BMFace::len, mul_v2_m3v3(), BMLoop::next, BMFace::no, NULL, poly_to_tri_count(), BMesh::totface, BMesh::totloop, UNLIKELY, BMLoop::v, and v.
Referenced by bpy_bmesh_calc_loop_triangles(), C_BVHTree_FromBMesh(), and editmesh_tessface_calc_intern().
A version of BM_mesh_calc_tessellation that avoids degenerate triangles.
Definition at line 1677 of file bmesh_polygon.c.
References axis_dominant_v3_to_m3(), axis_dominant_v3_to_m3_negate(), BLI_assert, BLI_heap_free(), BLI_heap_new_ex(), BLI_memarena_alloc(), BLI_memarena_clear(), BLI_memarena_free(), BLI_memarena_new(), BLI_MEMARENA_STD_BUFSIZE, BLI_POLYFILL_ALLOC_NGON_RESERVE, BLI_polyfill_beautify(), BLI_polyfill_beautify_quad_rotate_calc, BLI_polyfill_calc_arena(), bm, BM_FACE_FIRST_LOOP, BM_FACES_OF_MESH, BM_ITER_MESH, BM_verts_calc_rotate_beauty(), BMVert::co, float(), l, BMFace::len, mul_v2_m3v3(), BMLoop::next, BMFace::no, NULL, poly_to_tri_count(), BMLoop::prev, BMesh::totface, BMesh::totloop, UNLIKELY, and BMLoop::v.
Referenced by BMD_mesh_intersection(), and sculpt_gesture_apply_trim().
Definition at line 749 of file bmesh_polygon.c.
References bm_loop_normal_accum(), bmesh_disk_edge_next(), BMVert::e, e, l, len, normalize_v3(), BMLoop::radial_next, BMLoop::v, v, and zero_v3().
Referenced by BM_vert_normal_update().
Definition at line 719 of file bmesh_polygon.c.
References BM_elem_flag_test, bm_loop_normal_accum(), bmesh_disk_edge_next(), BMVert::e, e, BMLoop::f, l, len, normalize_v3(), BMLoop::radial_next, BMLoop::v, v, and zero_v3().
Referenced by VertsToTransData().
| void BM_vert_normal_update | ( | BMVert * | v | ) |
update a vert normal (but not the faces incident on it)
Definition at line 807 of file bmesh_polygon.c.
References BM_vert_calc_normal(), BMVert::no, and v.
Referenced by bm_decim_edge_collapse(), BM_edge_normals_update(), bm_vert_connect_pair(), bpy_bmvert_normal_update(), calc_solidify_normals(), and pbvh_bmesh_normals_update().
| void BM_vert_normal_update_all | ( | BMVert * | v | ) |
Definition at line 777 of file bmesh_polygon.c.
References BM_face_normal_update(), bm_loop_normal_accum(), bmesh_disk_edge_next(), BMVert::e, e, BMLoop::f, l, len, BMVert::no, normalize_v3(), BMLoop::radial_next, BMLoop::v, v, and zero_v3().
Referenced by mdisp_in_mdispquad().
Calculate a tangent from any 3 vertices.
The tangent aligns to the most unique edge (the edge most unlike the other two).
| r_tangent | Calculated unit length tangent (return value). |
Definition at line 367 of file bmesh_polygon.c.
References bm_vert_tri_find_unique_edge(), normalize_v3(), sub_v3_v3v3(), and verts.
Referenced by BM_face_calc_tangent_auto(), and getTransformOrientation_ex().
Calculate a tangent from any 3 vertices,
The tangent follows the center-line formed by the most unique edges center and the opposite vertex.
| r_tangent | Calculated unit length tangent (return value). |
Definition at line 384 of file bmesh_polygon.c.
References bm_vert_tri_find_unique_edge(), mid_v3_v3v3(), normalize_v3(), sub_v3_v3v3(), and verts.
Referenced by BM_face_calc_tangent_edge_pair().
|
static |
Utility function to calculate the edge which is most different from the other two.
(index + 1) % 3. Definition at line 322 of file bmesh_polygon.c.
References axis_sort_v3(), fabsf, len_squared_v3v3(), len_v3v3(), mid_v3_v3v3(), order, project_v3_v3v3(), sub_v3_v3(), and verts.
Referenced by BM_vert_tri_calc_tangent_edge(), and BM_vert_tri_calc_tangent_edge_pair().
Definition at line 990 of file bmesh_polygon.c.
References BM_verts_calc_normal_from_cloud_ex(), and NULL.
| void BM_verts_calc_normal_from_cloud_ex | ( | BMVert ** | varr, |
| int | varr_len, | ||
| float | r_normal[3], | ||
| float | r_center[3], | ||
| int * | r_index_tangent | ||
| ) |
Calculate a normal from a vertex cloud.
Definition at line 894 of file bmesh_polygon.c.
References center, BMVert::co, copy_v3_v3(), dot_v3v3(), float(), len_squared_v3(), len_squared_v3v3(), madd_v3_v3fl(), normal_quad_v3(), normal_tri_v3(), normalize_v3(), NULL, project_plane_normalized_v3_v3v3(), and sub_v3_v3v3().
Referenced by BM_verts_calc_normal_from_cloud(), and BM_verts_sort_radial_plane().
POLY ROTATE PLANE.
Rotates a polygon so that its normal is pointing towards the mesh Z axis
Definition at line 673 of file bmesh_polygon.c.
References axis_dominant_v3_to_m3(), copy_v3_v3(), mul_v2_m3v3(), normal, and verts.
Referenced by quad_co().