Blender V4.3
BKE_mesh_remap.hh File Reference

Go to the source code of this file.

Classes

struct  MeshPairRemapItem
 
struct  MeshPairRemap
 

Enumerations

enum  {
  MREMAP_USE_VERT = 1 << 4 , MREMAP_USE_EDGE = 1 << 5 , MREMAP_USE_LOOP = 1 << 6 , MREMAP_USE_POLY = 1 << 7 ,
  MREMAP_USE_NEAREST = 1 << 8 , MREMAP_USE_NORPROJ = 1 << 9 , MREMAP_USE_INTERP = 1 << 10 , MREMAP_USE_NORMAL = 1 << 11 ,
  MREMAP_MODE_VERT = 1 << 24 , MREMAP_MODE_VERT_NEAREST = MREMAP_MODE_VERT | MREMAP_USE_VERT | MREMAP_USE_NEAREST , MREMAP_MODE_VERT_EDGE_NEAREST = MREMAP_MODE_VERT | MREMAP_USE_EDGE | MREMAP_USE_NEAREST , MREMAP_MODE_VERT_EDGEINTERP_NEAREST ,
  MREMAP_MODE_VERT_FACE_NEAREST = MREMAP_MODE_VERT | MREMAP_USE_POLY | MREMAP_USE_NEAREST , MREMAP_MODE_VERT_POLYINTERP_NEAREST , MREMAP_MODE_VERT_POLYINTERP_VNORPROJ , MREMAP_MODE_EDGE = 1 << 25 ,
  MREMAP_MODE_EDGE_VERT_NEAREST = MREMAP_MODE_EDGE | MREMAP_USE_VERT | MREMAP_USE_NEAREST , MREMAP_MODE_EDGE_NEAREST = MREMAP_MODE_EDGE | MREMAP_USE_EDGE | MREMAP_USE_NEAREST , MREMAP_MODE_EDGE_POLY_NEAREST = MREMAP_MODE_EDGE | MREMAP_USE_POLY | MREMAP_USE_NEAREST , MREMAP_MODE_EDGE_EDGEINTERP_VNORPROJ ,
  MREMAP_MODE_LOOP = 1 << 26 , MREMAP_MODE_LOOP_NEAREST_LOOPNOR , MREMAP_MODE_LOOP_NEAREST_POLYNOR , MREMAP_MODE_LOOP_POLY_NEAREST = MREMAP_MODE_LOOP | MREMAP_USE_POLY | MREMAP_USE_NEAREST ,
  MREMAP_MODE_LOOP_POLYINTERP_NEAREST , MREMAP_MODE_LOOP_POLYINTERP_LNORPROJ , MREMAP_MODE_POLY = 1 << 27 , MREMAP_MODE_POLY_NEAREST = MREMAP_MODE_POLY | MREMAP_USE_POLY | MREMAP_USE_NEAREST ,
  MREMAP_MODE_POLY_NOR = MREMAP_MODE_POLY | MREMAP_USE_POLY | MREMAP_USE_NORMAL , MREMAP_MODE_POLY_POLYINTERP_PNORPROJ , MREMAP_MODE_TOPOLOGY = MREMAP_MODE_VERT | MREMAP_MODE_EDGE | MREMAP_MODE_LOOP | MREMAP_MODE_POLY
}
 

Functions

void BKE_mesh_remap_init (MeshPairRemap *map, int items_num)
 
void BKE_mesh_remap_free (MeshPairRemap *map)
 
void BKE_mesh_remap_item_define_invalid (MeshPairRemap *map, int index)
 
float BKE_mesh_remap_calc_difference_from_mesh (const SpaceTransform *space_transform, const float(*vert_positions_dst)[3], int numverts_dst, const Mesh *me_src)
 
void BKE_mesh_remap_find_best_match_from_mesh (const float(*vert_positions_dst)[3], int numverts_dst, const Mesh *me_src, SpaceTransform *r_space_transform)
 
void BKE_mesh_remap_calc_verts_from_mesh (int mode, const SpaceTransform *space_transform, float max_dist, float ray_radius, const float(*vert_positions_dst)[3], int numverts_dst, const Mesh *me_src, Mesh *me_dst, MeshPairRemap *r_map)
 
void BKE_mesh_remap_calc_edges_from_mesh (int mode, const SpaceTransform *space_transform, float max_dist, float ray_radius, const float(*vert_positions_dst)[3], int numverts_dst, const blender::int2 *edges_dst, int numedges_dst, const Mesh *me_src, Mesh *me_dst, MeshPairRemap *r_map)
 
void BKE_mesh_remap_calc_loops_from_mesh (int mode, const SpaceTransform *space_transform, float max_dist, float ray_radius, const Mesh *mesh_dst, const float(*vert_positions_dst)[3], int numverts_dst, const int *corner_verts_dst, int numloops_dst, const blender::OffsetIndices< int > faces_dst, const Mesh *me_src, MeshRemapIslandsCalc gen_islands_src, float islands_precision_src, MeshPairRemap *r_map)
 
void BKE_mesh_remap_calc_faces_from_mesh (int mode, const SpaceTransform *space_transform, float max_dist, float ray_radius, const Mesh *mesh_dst, const float(*vert_positions_dst)[3], int numverts_dst, const int *corner_verts, const blender::OffsetIndices< int > faces_dst, const Mesh *me_src, MeshPairRemap *r_map)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MREMAP_USE_VERT 
MREMAP_USE_EDGE 
MREMAP_USE_LOOP 
MREMAP_USE_POLY 
MREMAP_USE_NEAREST 
MREMAP_USE_NORPROJ 
MREMAP_USE_INTERP 
MREMAP_USE_NORMAL 
MREMAP_MODE_VERT 
MREMAP_MODE_VERT_NEAREST 
MREMAP_MODE_VERT_EDGE_NEAREST 
MREMAP_MODE_VERT_EDGEINTERP_NEAREST 
MREMAP_MODE_VERT_FACE_NEAREST 
MREMAP_MODE_VERT_POLYINTERP_NEAREST 
MREMAP_MODE_VERT_POLYINTERP_VNORPROJ 
MREMAP_MODE_EDGE 
MREMAP_MODE_EDGE_VERT_NEAREST 
MREMAP_MODE_EDGE_NEAREST 
MREMAP_MODE_EDGE_POLY_NEAREST 
MREMAP_MODE_EDGE_EDGEINTERP_VNORPROJ 
MREMAP_MODE_LOOP 
MREMAP_MODE_LOOP_NEAREST_LOOPNOR 
MREMAP_MODE_LOOP_NEAREST_POLYNOR 
MREMAP_MODE_LOOP_POLY_NEAREST 
MREMAP_MODE_LOOP_POLYINTERP_NEAREST 
MREMAP_MODE_LOOP_POLYINTERP_LNORPROJ 
MREMAP_MODE_POLY 
MREMAP_MODE_POLY_NEAREST 
MREMAP_MODE_POLY_NOR 
MREMAP_MODE_POLY_POLYINTERP_PNORPROJ 
MREMAP_MODE_TOPOLOGY 

Definition at line 55 of file BKE_mesh_remap.hh.

Function Documentation

◆ BKE_mesh_remap_calc_difference_from_mesh()

float BKE_mesh_remap_calc_difference_from_mesh ( const SpaceTransform * space_transform,
const float(*) vert_positions_dst[3],
int numverts_dst,
const Mesh * me_src )

Compute a value of the difference between both given meshes. The smaller the result, the better the match.

We return the inverse of the average of the inversed shortest distance from each dst vertex to src ones. In other words, beyond a certain (relatively small) distance, all differences have more or less the same weight in final result, which allows to reduce influence of a few high differences, in favor of a global good matching.

Definition at line 115 of file mesh_remap.cc.

References BKE_bvhtree_from_mesh_get(), BLI_space_transform_apply(), BVHTREE_FROM_VERTS, copy_v3_v3(), float, FLT_MAX, mesh_remap_bvhtree_query_nearest(), printf, and result.

Referenced by BKE_mesh_remap_find_best_match_from_mesh().

◆ BKE_mesh_remap_calc_edges_from_mesh()

◆ BKE_mesh_remap_calc_faces_from_mesh()

void BKE_mesh_remap_calc_faces_from_mesh ( int mode,
const SpaceTransform * space_transform,
float max_dist,
float ray_radius,
const Mesh * mesh_dst,
const float(*) vert_positions_dst[3],
int numverts_dst,
const int * corner_verts,
const blender::OffsetIndices< int > faces_dst,
const Mesh * me_src,
MeshPairRemap * r_map )

◆ BKE_mesh_remap_calc_loops_from_mesh()

void BKE_mesh_remap_calc_loops_from_mesh ( int mode,
const SpaceTransform * space_transform,
float max_dist,
float ray_radius,
const Mesh * mesh_dst,
const float(*) vert_positions_dst[3],
int numverts_dst,
const int * corner_verts_dst,
int numloops_dst,
const blender::OffsetIndices< int > faces_dst,
const Mesh * me_src,
MeshRemapIslandsCalc gen_islands_src,
float islands_precision_src,
MeshPairRemap * r_map )

Definition at line 1210 of file mesh_remap.cc.

References ASTAR_STEPS_MAX, BKE_bvhtree_from_mesh_get(), BKE_mesh_loop_islands_free(), BKE_mesh_origindex_map_create_corner_tri(), BKE_mesh_remap_init(), BKE_mesh_remap_item_define_invalid(), BLI_assert, BLI_astar_graph_free(), BLI_astar_graph_solve(), BLI_astar_solution_clear(), BLI_astar_solution_free(), BLI_astar_solution_init(), BLI_space_transform_apply(), BLI_space_transform_apply_normal(), BVHTREE_FROM_CORNER_TRIS, bvhtree_from_mesh_corner_tris_ex(), bvhtree_from_mesh_verts_ex(), BVHTREE_FROM_VERTS, CD_PROP_BOOL, closest_on_tri_to_point_v3(), BVHTreeRayHit::co, copy_v3_v3(), Mesh::corners_num, count, MeshElemMap::count, BLI_AStarGNLink::custom_data, BLI_AStarGraph::custom_data, BLI_AStarSolution::custom_data, CustomData_get_layer_named(), blender::Span< T >::data(), dot(), dot_v3v3(), Mesh::edge_data, ELEM, blender::bke::mesh::face_center_calc(), IslandResult::factor, blender::bits::BitVector< InlineBufferCapacity, Allocator >::fill(), float, FLT_MAX, free_bvhtree_from_mesh(), IslandResult::hit_dist, IslandResult::hit_point, BVHTreeRayHit::index, blender::offset_indices::OffsetIndices< T >::index_range(), blender::Span< T >::index_range(), IslandResult::index_src, MeshElemMap::indices, MeshIslandStore::innercut_type, int, MeshIslandStore::island_type, MeshIslandStore::islands, MeshIslandStore::islands_num, MeshIslandStore::item_type, MeshIslandStore::items_to_islands, len_squared_v3v3(), max_ii(), MEM_callocN, MEM_freeN(), MEM_mallocN, MEM_reallocN, mesh_island_to_astar_graph(), mesh_remap_bvhtree_query_nearest(), mesh_remap_bvhtree_query_raycast(), mesh_remap_calc_loops_astar_f_cost(), mesh_remap_interp_face_data_get(), mesh_remap_item_define(), MISLAND_TYPE_EDGE, MISLAND_TYPE_LOOP, MISLAND_TYPE_POLY, MREMAP_DEFAULT_BUFSIZE, MREMAP_MODE_LOOP, MREMAP_MODE_LOOP_NEAREST_LOOPNOR, MREMAP_MODE_LOOP_NEAREST_POLYNOR, MREMAP_MODE_LOOP_POLY_NEAREST, MREMAP_MODE_TOPOLOGY, MREMAP_RAYCAST_APPROXIMATE_FAC, MREMAP_RAYCAST_APPROXIMATE_NR, MREMAP_USE_LOOP, MREMAP_USE_NORMAL, MREMAP_USE_NORPROJ, MREMAP_USE_POLY, MREMAP_USE_VERT, POINTER_AS_INT, POINTER_FROM_INT, BLI_AStarSolution::prev_links, BLI_AStarSolution::prev_nodes, blender::Array< T, InlineBufferCapacity, Allocator >::reinitialize(), blender::IndexRange::size(), blender::offset_indices::OffsetIndices< T >::size(), blender::Span< T >::size(), blender::Span< T >::slice(), blender::IndexRange::start(), BLI_AStarSolution::steps, Mesh::verts_num, and w().

Referenced by BKE_object_data_transfer_ex().

◆ BKE_mesh_remap_calc_verts_from_mesh()

◆ BKE_mesh_remap_find_best_match_from_mesh()

void BKE_mesh_remap_find_best_match_from_mesh ( const float(*) vert_positions_dst[3],
int numverts_dst,
const Mesh * me_src,
SpaceTransform * r_space_transform )

Set r_space_transform so that best bbox of dst matches best bbox of src.

Definition at line 245 of file mesh_remap.cc.

References BKE_mesh_remap_calc_difference_from_mesh(), BLI_space_transform_global_from_matrices(), copy_m4_m4(), blender::Span< T >::data(), float, FLT_MAX, mesh_calc_eigen_matrix(), mul_v3_fl(), and Mesh::verts_num.

Referenced by BKE_object_data_transfer_ex().

◆ BKE_mesh_remap_free()

void BKE_mesh_remap_free ( MeshPairRemap * map)

Definition at line 316 of file mesh_remap.cc.

References BLI_memarena_free().

Referenced by BKE_mesh_remap_init(), and BKE_object_data_transfer_ex().

◆ BKE_mesh_remap_init()

◆ BKE_mesh_remap_item_define_invalid()