Blender V4.3
mesh_evaluate.cc File Reference
#include <climits>
#include "MEM_guardedalloc.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "BLI_array_utils.hh"
#include "BLI_index_range.hh"
#include "BLI_math_geom.h"
#include "BLI_span.hh"
#include "BLI_utildefines.h"
#include "BLI_virtual_array.hh"
#include "BKE_attribute.hh"
#include "BKE_mesh.hh"

Go to the source code of this file.

Namespaces

namespace  blender
 
namespace  blender::bke
 
namespace  blender::bke::mesh
 

Functions

static float3 blender::bke::mesh::face_center_calc_ngon (const Span< float3 > vert_positions, const Span< int > face_verts)
 
static float blender::bke::mesh::mesh_calc_face_volume_centroid_with_reference_center (const Span< float3 > positions, const Span< int > face_verts, const float3 &reference_center, float r_cent[3])
 
static float blender::bke::mesh::face_area_centroid_calc (const Span< float3 > positions, const Span< int > face_verts, float r_cent[3])
 
void blender::bke::mesh_edge_hide_from_vert (Span< int2 > edges, Span< bool > hide_vert, MutableSpan< bool > hide_edge)
 
void blender::bke::mesh_face_hide_from_vert (OffsetIndices< int > faces, Span< int > corner_verts, Span< bool > hide_vert, MutableSpan< bool > hide_poly)
 
void blender::bke::mesh_hide_vert_flush (Mesh &mesh)
 
void blender::bke::mesh_hide_face_flush (Mesh &mesh)
 
Polygon Data Evaluation
float3 blender::bke::mesh::face_center_calc (Span< float3 > vert_positions, Span< int > face_verts)
 
float blender::bke::mesh::face_area_calc (Span< float3 > vert_positions, Span< int > face_verts)
 
void blender::bke::mesh::face_angles_calc (Span< float3 > vert_positions, Span< int > face_verts, MutableSpan< float > angles)
 
Polygon Calculations
float BKE_mesh_calc_area (const Mesh *mesh)
 
static float UNUSED_FUNCTION mesh_calc_face_volume_centroid (const int *face_verts, const int face_size, const float(*positions)[3], float r_cent[3])
 
Mesh Center Calculation
bool BKE_mesh_center_median (const Mesh *mesh, float r_cent[3])
 
bool BKE_mesh_center_median_from_faces (const Mesh *mesh, float r_cent[3])
 
bool BKE_mesh_center_of_surface (const Mesh *mesh, float r_cent[3])
 
bool BKE_mesh_center_of_volume (const Mesh *mesh, float r_cent[3])
 
Mesh Volume Calculation
static bool mesh_calc_center_centroid_ex (const float(*positions)[3], int, const blender::int3 *corner_tris, int corner_tris_num, const int *corner_verts, float r_center[3])
 
void BKE_mesh_calc_volume (const float(*vert_positions)[3], const int mverts_num, const blender::int3 *corner_tris, const int corner_tris_num, const int *corner_verts, float *r_volume, float r_center[3])
 
Mesh Displacement Data Flip
void BKE_mesh_mdisp_flip (MDisps *md, const bool use_loop_mdisp_flip)
 
Selection Interpolation
void blender::bke::mesh_select_face_flush (Mesh &mesh)
 
void blender::bke::mesh_select_vert_flush (Mesh &mesh)
 
void blender::bke::mesh_select_edge_flush (Mesh &mesh)
 
Mesh Spatial Calculation
void BKE_mesh_calc_relative_deform (const int *face_offsets, const int faces_num, const int *corner_verts, 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])
 

Detailed Description

Functions to evaluate mesh data.

Definition in file mesh_evaluate.cc.

Function Documentation

◆ BKE_mesh_calc_area()

float BKE_mesh_calc_area ( const Mesh * mesh)

◆ BKE_mesh_calc_relative_deform()

void BKE_mesh_calc_relative_deform ( const int * face_offsets,
int faces_num,
const int * corner_verts,
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] )

This function takes the difference between 2 vertex-coord-arrays (vert_cos_src, vert_cos_dst), and applies the difference to vert_cos_new relative to vert_cos_org.

Parameters
vert_cos_srcreference deform source.
vert_cos_dstreference deform destination.
vert_cos_orgreference for the output location.
vert_cos_newresulting coords.

Definition at line 715 of file mesh_evaluate.cc.

References add_v3_v3(), copy_v3_v3(), faces, MEM_calloc_arrayN, MEM_freeN(), mul_v3_fl(), and transform_point_by_tri_v3().

Referenced by meshcache_do().

◆ BKE_mesh_calc_volume()

void BKE_mesh_calc_volume ( const float(*) vert_positions[3],
int mverts_num,
const blender::int3 * corner_tris,
int corner_tris_num,
const int * corner_verts,
float * r_volume,
float r_center[3] )

Calculate the volume and center.

Parameters
r_volumeVolume (unsigned).
r_centerCenter of mass.

Definition at line 392 of file mesh_evaluate.cc.

References fabsf, madd_v3_v3fl(), mesh_calc_center_centroid_ex(), mul_v3_fl(), v2, volume_tetrahedron_signed_v3(), and zero_v3().

◆ BKE_mesh_center_median()

bool BKE_mesh_center_median ( const Mesh * mesh,
float r_cent[3] )

◆ BKE_mesh_center_median_from_faces()

bool BKE_mesh_center_median_from_faces ( const Mesh * mesh,
float r_cent[3] )

Calculate the center from faces, use when we want to ignore vertex locations that don't have connected faces.

Definition at line 256 of file mesh_evaluate.cc.

References add_v3_v3(), mul_v3_fl(), blender::Span< T >::slice(), and zero_v3().

Referenced by BKE_mesh_center_of_volume().

◆ BKE_mesh_center_of_surface()

◆ BKE_mesh_center_of_volume()

bool BKE_mesh_center_of_volume ( const Mesh * mesh,
float r_cent[3] )

◆ BKE_mesh_mdisp_flip()

void BKE_mesh_mdisp_flip ( MDisps * md,
bool use_loop_mdisp_flip )

Flip a single corner's MDisps structure, low level function to be called from face-flipping code which re-arranged the mdisps themselves.

Definition at line 464 of file mesh_evaluate.cc.

References MDisps::disps, float, int, sqrt(), swap_v3_v3(), MDisps::totdisp, UNLIKELY, x, and y.

Referenced by bmesh_kernel_loop_reverse(), and blender::bke::mesh_flip_faces().

◆ mesh_calc_center_centroid_ex()

static bool mesh_calc_center_centroid_ex ( const float(*) positions[3],
int ,
const blender::int3 * corner_tris,
int corner_tris_num,
const int * corner_verts,
float r_center[3] )
static

Definition at line 355 of file mesh_evaluate.cc.

References area_tri_v3(), madd_v3_v3fl(), mul_v3_fl(), v2, and zero_v3().

Referenced by BKE_mesh_calc_volume().

◆ mesh_calc_face_volume_centroid()

static float UNUSED_FUNCTION mesh_calc_face_volume_centroid ( const int * face_verts,
const int face_size,
const float(*) positions[3],
float r_cent[3] )
static

Definition at line 103 of file mesh_evaluate.cc.

References volume_tri_tetrahedron_signed_v3_6x(), and zero_v3().