Blender
V3.3
|
#include <climits>
#include "MEM_guardedalloc.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "BLI_alloca.h"
#include "BLI_bitmap.h"
#include "BLI_edgehash.h"
#include "BLI_index_range.hh"
#include "BLI_math.h"
#include "BLI_span.hh"
#include "BLI_utildefines.h"
#include "BKE_customdata.h"
#include "BKE_mesh.h"
#include "BKE_multires.h"
Go to the source code of this file.
Functions | |
void | BKE_mesh_mdisp_flip (MDisps *md, const bool use_loop_mdisp_flip) |
void | BKE_mesh_polygon_flip_ex (MPoly *mpoly, MLoop *mloop, CustomData *ldata, float(*lnors)[3], MDisps *mdisp, const bool use_loop_mdisp_flip) |
void | BKE_mesh_polygon_flip (MPoly *mpoly, MLoop *mloop, CustomData *ldata) |
void | BKE_mesh_polygons_flip (MPoly *mpoly, MLoop *mloop, CustomData *ldata, int totpoly) |
Polygon Calculations | |
static void | mesh_calc_ngon_normal (const MPoly *mpoly, const MLoop *loopstart, const MVert *mvert, float normal[3]) |
void | BKE_mesh_calc_poly_normal (const MPoly *mpoly, const MLoop *loopstart, const MVert *mvarray, float r_no[3]) |
static void | mesh_calc_ngon_normal_coords (const MPoly *mpoly, const MLoop *loopstart, const float(*vertex_coords)[3], float r_normal[3]) |
void | BKE_mesh_calc_poly_normal_coords (const MPoly *mpoly, const MLoop *loopstart, const float(*vertex_coords)[3], float r_no[3]) |
static void | mesh_calc_ngon_center (const MPoly *mpoly, const MLoop *loopstart, const MVert *mvert, float cent[3]) |
void | BKE_mesh_calc_poly_center (const MPoly *mpoly, const MLoop *loopstart, const MVert *mvarray, float r_cent[3]) |
float | BKE_mesh_calc_poly_area (const MPoly *mpoly, const MLoop *loopstart, const MVert *mvarray) |
float | BKE_mesh_calc_area (const Mesh *me) |
float | BKE_mesh_calc_poly_uv_area (const MPoly *mpoly, const MLoopUV *uv_array) |
static float UNUSED_FUNCTION() | mesh_calc_poly_volume_centroid (const MPoly *mpoly, const MLoop *loopstart, const MVert *mvarray, float r_cent[3]) |
static float | mesh_calc_poly_volume_centroid_with_reference_center (const MPoly *mpoly, const MLoop *loopstart, const MVert *mvarray, const float reference_center[3], float r_cent[3]) |
static float | mesh_calc_poly_area_centroid (const MPoly *mpoly, const MLoop *loopstart, const MVert *mvarray, float r_cent[3]) |
void | BKE_mesh_calc_poly_angles (const MPoly *mpoly, const MLoop *loopstart, const MVert *mvarray, float angles[]) |
void | BKE_mesh_poly_edgehash_insert (EdgeHash *ehash, const MPoly *mp, const MLoop *mloop) |
void | BKE_mesh_poly_edgebitmap_insert (uint *edge_bitmap, const MPoly *mp, const MLoop *mloop) |
Mesh Center Calculation | |
bool | BKE_mesh_center_median (const Mesh *me, float r_cent[3]) |
bool | BKE_mesh_center_median_from_polys (const Mesh *me, float r_cent[3]) |
bool | BKE_mesh_center_bounds (const Mesh *me, float r_cent[3]) |
bool | BKE_mesh_center_of_surface (const Mesh *me, float r_cent[3]) |
bool | BKE_mesh_center_of_volume (const Mesh *me, float r_cent[3]) |
Mesh Volume Calculation | |
static bool | mesh_calc_center_centroid_ex (const MVert *mverts, int UNUSED(mverts_num), const MLoopTri *looptri, int looptri_num, const MLoop *mloop, float r_center[3]) |
void | BKE_mesh_calc_volume (const MVert *mverts, const int mverts_num, const MLoopTri *looptri, const int looptri_num, const MLoop *mloop, float *r_volume, float r_center[3]) |
Mesh Flag Flushing | |
void | BKE_mesh_flush_hidden_from_verts_ex (const MVert *mvert, const MLoop *mloop, MEdge *medge, const int totedge, MPoly *mpoly, const int totpoly) |
void | BKE_mesh_flush_hidden_from_verts (Mesh *me) |
void | BKE_mesh_flush_hidden_from_polys_ex (MVert *mvert, const MLoop *mloop, MEdge *medge, const int UNUSED(totedge), const MPoly *mpoly, const int totpoly) |
void | BKE_mesh_flush_hidden_from_polys (Mesh *me) |
void | BKE_mesh_flush_select_from_polys_ex (MVert *mvert, const int totvert, const MLoop *mloop, MEdge *medge, const int totedge, const MPoly *mpoly, const int totpoly) |
void | BKE_mesh_flush_select_from_polys (Mesh *me) |
static void | mesh_flush_select_from_verts (const Span< MVert > verts, const Span< MLoop > loops, MutableSpan< MEdge > edges, MutableSpan< MPoly > polys) |
void | BKE_mesh_flush_select_from_verts (Mesh *me) |
Mesh Spatial Calculation | |
void | BKE_mesh_calc_relative_deform (const MPoly *mpoly, const int totpoly, const MLoop *mloop, const int totvert, const float(*vert_cos_src)[3], const float(*vert_cos_dst)[3], const float(*vert_cos_org)[3], float(*vert_cos_new)[3]) |
Functions to evaluate mesh data.
Definition in file mesh_evaluate.cc.
Definition at line 204 of file mesh_evaluate.cc.
References BKE_mesh_calc_poly_area(), MPoly::loopstart, Mesh::mloop, Mesh::mpoly, Mesh::mvert, and Mesh::totpoly.
void BKE_mesh_calc_poly_angles | ( | const MPoly * | mpoly, |
const MLoop * | loopstart, | ||
const MVert * | mvarray, | ||
float | angles[] | ||
) |
Definition at line 343 of file mesh_evaluate.cc.
References angle_normalized_v3v3(), copy_v3_v3(), normalize_v3(), sub_v3_v3v3(), MPoly::totloop, and v.
float BKE_mesh_calc_poly_area | ( | const MPoly * | mpoly, |
const MLoop * | loopstart, | ||
const MVert * | mvarray | ||
) |
Definition at line 183 of file mesh_evaluate.cc.
References blender::compositor::area(), area_poly_v3(), area_tri_v3(), BLI_array_alloca, MVert::co, copy_v3_v3(), float(), MPoly::totloop, v, and MLoop::v.
Referenced by BKE_mesh_calc_area().
void BKE_mesh_calc_poly_center | ( | const MPoly * | mpoly, |
const MLoop * | loopstart, | ||
const MVert * | mvarray, | ||
float | r_cent[3] | ||
) |
Definition at line 160 of file mesh_evaluate.cc.
References mesh_calc_ngon_center(), mid_v3_v3v3v3(), mid_v3_v3v3v3v3(), MPoly::totloop, and v.
void BKE_mesh_calc_poly_normal | ( | const MPoly * | mpoly, |
const MLoop * | loopstart, | ||
const MVert * | mvarray, | ||
float | r_no[3] | ||
) |
Definition at line 69 of file mesh_evaluate.cc.
References mesh_calc_ngon_normal(), normal_quad_v3(), normal_tri_v3(), MPoly::totloop, and v.
Referenced by mesh_calc_poly_area_centroid().
void BKE_mesh_calc_poly_normal_coords | ( | const MPoly * | mpoly, |
const MLoop * | loopstart, | ||
const float(*) | vertex_coords[3], | ||
float | r_no[3] | ||
) |
Definition at line 118 of file mesh_evaluate.cc.
References mesh_calc_ngon_normal_coords(), normal_quad_v3(), normal_tri_v3(), MPoly::totloop, and v.
Definition at line 222 of file mesh_evaluate.cc.
References blender::compositor::area(), area_poly_v2(), BLI_array_alloca, copy_v2_v2(), float(), MPoly::loopstart, and MPoly::totloop.
void BKE_mesh_calc_relative_deform | ( | const MPoly * | mpoly, |
const int | totpoly, | ||
const MLoop * | mloop, | ||
const int | totvert, | ||
const float(*) | vert_cos_src[3], | ||
const float(*) | vert_cos_dst[3], | ||
const float(*) | vert_cos_org[3], | ||
float(*) | vert_cos_new[3] | ||
) |
Definition at line 900 of file mesh_evaluate.cc.
References add_v3_v3(), copy_v3_v3(), MPoly::loopstart, MEM_calloc_arrayN, MEM_freeN, mul_v3_fl(), MPoly::totloop, transform_point_by_tri_v3(), and MLoop::v.
void BKE_mesh_calc_volume | ( | const MVert * | mverts, |
const int | mverts_num, | ||
const MLoopTri * | looptri, | ||
const int | looptri_num, | ||
const MLoop * | mloop, | ||
float * | r_volume, | ||
float | r_center[3] | ||
) |
Definition at line 568 of file mesh_evaluate.cc.
References center, BMVert::co, MVert::co, fabsf, madd_v3_v3fl(), mesh_calc_center_centroid_ex(), mul_v3_fl(), MLoopTri::tri, MLoop::v, v1, v2, volume_tetrahedron_signed_v3(), and zero_v3().
Definition at line 441 of file mesh_evaluate.cc.
References BKE_mesh_minmax(), INIT_MINMAX, max, mid_v3_v3v3(), and min.
Definition at line 404 of file mesh_evaluate.cc.
References add_v3_v3(), MVert::co, mul_v3_fl(), Mesh::mvert, Mesh::totvert, and zero_v3().
Referenced by BKE_mesh_center_of_surface().
Definition at line 419 of file mesh_evaluate.cc.
References add_v3_v3(), MPoly::loopstart, Mesh::mloop, Mesh::mpoly, mul_v3_fl(), Mesh::mvert, MPoly::totloop, Mesh::totpoly, v, and zero_v3().
Referenced by BKE_mesh_center_of_volume().
Definition at line 453 of file mesh_evaluate.cc.
References BKE_mesh_center_median(), is_finite_v3(), MPoly::loopstart, madd_v3_v3fl(), mesh_calc_poly_area_centroid(), Mesh::mloop, Mesh::mpoly, mul_v3_fl(), Mesh::mvert, Mesh::totpoly, UNLIKELY, and zero_v3().
Definition at line 484 of file mesh_evaluate.cc.
References add_v3_v3(), BKE_mesh_center_median_from_polys(), copy_v3_v3(), is_finite_v3(), MPoly::loopstart, mesh_calc_poly_volume_centroid_with_reference_center(), Mesh::mloop, Mesh::mpoly, mul_v3_fl(), Mesh::mvert, Mesh::totpoly, UNLIKELY, and zero_v3().
Definition at line 800 of file mesh_evaluate.cc.
References BKE_mesh_flush_hidden_from_polys_ex(), Mesh::medge, Mesh::mloop, Mesh::mpoly, Mesh::mvert, Mesh::totedge, and Mesh::totpoly.
Referenced by BKE_sculpt_sync_face_sets_visibility_to_base_mesh(), paintface_hide(), and paintface_reveal().
void BKE_mesh_flush_hidden_from_polys_ex | ( | MVert * | mvert, |
const MLoop * | mloop, | ||
MEdge * | medge, | ||
const int | UNUSEDtotedge, | ||
const MPoly * | mpoly, | ||
const int | totpoly | ||
) |
Definition at line 769 of file mesh_evaluate.cc.
References MLoop::e, MVert::flag, MEdge::flag, ME_HIDE, and MLoop::v.
Referenced by BKE_mesh_flush_hidden_from_polys().
Definition at line 763 of file mesh_evaluate.cc.
References BKE_mesh_flush_hidden_from_verts_ex(), Mesh::medge, Mesh::mloop, Mesh::mpoly, Mesh::mvert, Mesh::totedge, and Mesh::totpoly.
Referenced by face_set_edit_do_post_visibility_updates(), hide_show_exec(), paintvert_hide(), paintvert_reveal(), sculpt_face_set_init_exec(), and sculpt_undo_restore_list().
void BKE_mesh_flush_hidden_from_verts_ex | ( | const MVert * | mvert, |
const MLoop * | mloop, | ||
MEdge * | medge, | ||
const int | totedge, | ||
MPoly * | mpoly, | ||
const int | totpoly | ||
) |
Definition at line 735 of file mesh_evaluate.cc.
References e, MVert::flag, MPoly::flag, MPoly::loopstart, ME_HIDE, MPoly::totloop, and MLoop::v.
Referenced by BKE_mesh_flush_hidden_from_verts().
Definition at line 843 of file mesh_evaluate.cc.
References BKE_mesh_flush_select_from_polys_ex(), Mesh::medge, Mesh::mloop, Mesh::mpoly, Mesh::mvert, Mesh::totedge, Mesh::totpoly, and Mesh::totvert.
Referenced by ed_vwpaintmode_exit_generic(), paint_weight_gradient_exec(), and paintface_flush_flags().
void BKE_mesh_flush_select_from_polys_ex | ( | MVert * | mvert, |
const int | totvert, | ||
const MLoop * | mloop, | ||
MEdge * | medge, | ||
const int | totedge, | ||
const MPoly * | mpoly, | ||
const int | totpoly | ||
) |
Definition at line 806 of file mesh_evaluate.cc.
References MLoop::e, MVert::flag, MEdge::flag, MPoly::flag, MPoly::loopstart, ME_FACE_SEL, SELECT, MPoly::totloop, and MLoop::v.
Referenced by BKE_mesh_flush_select_from_polys().
Definition at line 886 of file mesh_evaluate.cc.
References Mesh::medge, mesh_flush_select_from_verts(), Mesh::mloop, Mesh::mpoly, Mesh::mvert, Mesh::totedge, Mesh::totloop, Mesh::totpoly, and Mesh::totvert.
Referenced by ed_vwpaintmode_exit_generic(), and paintvert_flush_flags().
Flip a single MLoop's MDisps structure, low level function to be called from face-flipping code which re-arranged the mdisps themselves.
Definition at line 635 of file mesh_evaluate.cc.
References MDisps::disps, float(), sqrt(), SWAP, swap_v3_v3(), MDisps::totdisp, UNLIKELY, x, and y.
Referenced by BKE_mesh_polygon_flip_ex(), and bmesh_kernel_loop_reverse().
Definition at line 385 of file mesh_evaluate.cc.
References BLI_BITMAP_ENABLE, MLoop::e, and MPoly::totloop.
Definition at line 369 of file mesh_evaluate.cc.
References BLI_edgehash_reinsert(), MPoly::totloop, and MLoop::v.
void BKE_mesh_polygon_flip | ( | MPoly * | mpoly, |
MLoop * | mloop, | ||
CustomData * | ldata | ||
) |
Definition at line 714 of file mesh_evaluate.cc.
References BKE_mesh_polygon_flip_ex(), CD_MDISPS, and CustomData_get_layer().
void BKE_mesh_polygon_flip_ex | ( | struct MPoly * | mpoly, |
struct MLoop * | mloop, | ||
struct CustomData * | ldata, | ||
float(*) | lnors[3], | ||
struct MDisps * | mdisp, | ||
bool | use_loop_mdisp_flip | ||
) |
Flip (invert winding of) the given mpoly, i.e. reverse order of its loops (keeping the same vertex as 'start point').
mpoly | the polygon to flip. |
mloop | the full loops array. |
ldata | the loops custom data. |
Definition at line 671 of file mesh_evaluate.cc.
References BKE_mesh_mdisp_flip(), CD_MLOOP, CustomData_get_layer(), CustomData_swap(), e, MLoop::e, MPoly::loopstart, SWAP, swap_v3_v3(), and MPoly::totloop.
Referenced by BKE_mesh_polygon_flip(), BKE_mesh_polygons_flip(), and polygons_check_flip().
void BKE_mesh_polygons_flip | ( | struct MPoly * | mpoly, |
struct MLoop * | mloop, | ||
struct CustomData * | ldata, | ||
int | totpoly | ||
) |
Flip (invert winding of) all polygons (used to inverse their normals).
Definition at line 720 of file mesh_evaluate.cc.
References BKE_mesh_polygon_flip_ex(), CD_MDISPS, and CustomData_get_layer().
|
static |
Definition at line 530 of file mesh_evaluate.cc.
References blender::compositor::area(), area_tri_v3(), BMVert::co, MVert::co, madd_v3_v3fl(), mul_v3_fl(), MLoopTri::tri, MLoop::v, v1, v2, and zero_v3().
Referenced by BKE_mesh_calc_volume().
|
static |
Definition at line 146 of file mesh_evaluate.cc.
References float(), madd_v3_v3fl(), MPoly::totloop, v, w(), and zero_v3().
Referenced by BKE_mesh_calc_poly_center().
|
static |
Definition at line 46 of file mesh_evaluate.cc.
References add_newell_cross_v3_v3v3(), MVert::co, normal, normalize_v3(), MPoly::totloop, UNLIKELY, MLoop::v, and zero_v3().
Referenced by BKE_mesh_calc_poly_normal().
|
static |
Definition at line 95 of file mesh_evaluate.cc.
References add_newell_cross_v3_v3v3(), normalize_v3(), MPoly::totloop, UNLIKELY, MLoop::v, and zero_v3().
Referenced by BKE_mesh_calc_poly_normal_coords().
|
static |
Definition at line 313 of file mesh_evaluate.cc.
References area_tri_signed_v3(), BKE_mesh_calc_poly_normal(), copy_v3_v3(), madd_v3_v3fl(), mid_v3_v3v3v3(), mul_v3_fl(), normal, MPoly::totloop, v, v1, v2, and zero_v3().
Referenced by BKE_mesh_center_of_surface().
|
static |
Definition at line 240 of file mesh_evaluate.cc.
References MPoly::totloop, MLoop::v, volume_tri_tetrahedron_signed_v3_6x(), and zero_v3().
|
static |
A version of mesh_calc_poly_volume_centroid that takes an initial reference center, use this to increase numeric stability as the quality of the result becomes very low quality as the value moves away from 0.0, see: T65986.
Definition at line 282 of file mesh_evaluate.cc.
References copy_v3_v3(), sub_v3_v3v3(), MPoly::totloop, v, volume_tri_tetrahedron_signed_v3_6x(), and zero_v3().
Referenced by BKE_mesh_center_of_volume().
|
static |
Definition at line 849 of file mesh_evaluate.cc.
References MPoly::flag, blender::MutableSpan< T >::index_range(), MPoly::loopstart, ME_FACE_SEL, ME_HIDE, SELECT, blender::Span< T >::slice(), MPoly::totloop, and verts.
Referenced by BKE_mesh_flush_select_from_verts().