|
Blender
V2.93
|
Go to the source code of this file.
Classes | |
| struct | _EdgeHash_Edge |
| struct | _EdgeHash_Entry |
| struct | EdgeHashIterator |
| struct | EdgeSetIterator |
Macros | |
| #define | BLI_EDGEHASH_SIZE_GUESS_FROM_LOOPS(totloop) ((totloop) / 2) |
| #define | BLI_EDGEHASH_SIZE_GUESS_FROM_POLYS(totpoly) ((totpoly)*2) |
Typedefs | |
| typedef struct EdgeHash | EdgeHash |
| typedef struct EdgeHashIterator | EdgeHashIterator |
| typedef void(* | EdgeHashFreeFP) (void *key) |
| typedef struct EdgeSet | EdgeSet |
| typedef struct EdgeSetIterator | EdgeSetIterator |
Enumerations | |
| enum | { EDGEHASH_FLAG_ALLOW_DUPES = (1 << 0) } |
| #define BLI_EDGEHASH_SIZE_GUESS_FROM_LOOPS | ( | totloop | ) | ((totloop) / 2) |
Definition at line 114 of file BLI_edgehash.h.
| #define BLI_EDGEHASH_SIZE_GUESS_FROM_POLYS | ( | totpoly | ) | ((totpoly)*2) |
Definition at line 115 of file BLI_edgehash.h.
Definition at line 1 of file BLI_edgehash.h.
| typedef void(* EdgeHashFreeFP) (void *key) |
Definition at line 48 of file BLI_edgehash.h.
| typedef struct EdgeHashIterator EdgeHashIterator |
Definition at line 109 of file BLI_edgehash.h.
| typedef struct EdgeSetIterator EdgeSetIterator |
| anonymous enum |
| Enumerator | |
|---|---|
| EDGEHASH_FLAG_ALLOW_DUPES | |
Definition at line 50 of file BLI_edgehash.h.
| void BLI_edgehash_clear | ( | EdgeHash * | eh, |
| EdgeHashFreeFP | free_value | ||
| ) |
Wraps BLI_edgehash_clear_ex with zero entries reserved.
Definition at line 455 of file edgehash.c.
References BLI_edgehash_clear_ex().
Referenced by TEST().
| void BLI_edgehash_clear_ex | ( | EdgeHash * | eh, |
| EdgeHashFreeFP | free_value, | ||
| const uint | reserve | ||
| ) |
Ensure (v0, v1) is exists in eh.
This handles the common situation where the caller needs ensure a key is added to eh, constructing a new value in the case the key isn't found. Otherwise use the existing value.
Such situations typically incur multiple lookups, however this function avoids them by ensuring the key is added, returning a pointer to the value so it can be used or initialized by the caller.
Definition at line 355 of file edgehash.c.
References edgehash_ensure_can_insert(), edgehash_insert(), edgehash_insert_at_slot(), EH_INDEX_HAS_EDGE, EdgeHash::entries, init_edge(), ITER_SLOTS, NULL, SLOT_EMPTY, v1, and _EdgeHash_Entry::value.
Referenced by BKE_mesh_merge_verts(), laplacian_increase_edge_count(), lines_adjacency_triangle(), set_edge_adjacency_lines_indices(), split_faces_prepare_new_edges(), statvis_calc_sharp(), and TEST().
| void BLI_edgehash_free | ( | EdgeHash * | eh, |
| EdgeHashFreeFP | free_value | ||
| ) |
Definition at line 244 of file edgehash.c.
References edgehash_free_values(), EdgeHash::entries, EdgeHash::map, and MEM_freeN.
Referenced by BKE_mesh_convert_mfaces_to_mpolys_ex(), BKE_mesh_validate_arrays(), ccgDM_release(), customdata_compare(), cutEdges(), DRW_displist_indexbuf_create_edges_adjacency_lines(), explodeMesh(), extract_lines_adjacency_finish(), laplacian_system_construct_end(), make_edges_mdata_extend(), mesh_calc_edges_mdata(), psys_sph_finalize(), split_faces_prepare_new_edges(), statvis_calc_sharp(), TEST(), and test_polyfill_topology().
Return boolean true/false if edge (v0,v1) in hash.
Definition at line 426 of file edgehash.c.
References edgehash_lookup_entry(), NULL, and v1.
Referenced by BKE_mesh_validate_arrays(), make_edges_mdata_extend(), and TEST().
Insert edge (v0, v1) into hash with given value, does not check for duplicates.
Definition at line 279 of file edgehash.c.
References edgehash_ensure_can_insert(), edgehash_insert(), init_edge(), and v1.
Referenced by BKE_mesh_convert_mfaces_to_mpolys_ex(), BKE_mesh_validate_arrays(), ccgDM_copyFinalLoopArray(), customdata_compare(), mesh_calc_edges_mdata(), sph_springhash_build(), TEST(), and test_polyfill_topology().
| int BLI_edgehash_len | ( | EdgeHash * | eh | ) |
Return number of keys in hash.
Definition at line 434 of file edgehash.c.
References EdgeHash::length.
Referenced by make_edges_mdata_extend(), TEST(), and test_polyfill_topology().
Return value for given edge (v0, v1), or NULL if if key does not exist in hash. (If need exists to differentiate between key-value being NULL and lack of key then see BLI_edgehash_lookup_p().
Definition at line 325 of file edgehash.c.
References edgehash_lookup_entry(), NULL, v1, and _EdgeHash_Entry::value.
Referenced by BKE_mesh_validate_arrays(), copyFinalLoopArray_task_cb(), customdata_compare(), edgecut_get(), laplacian_edge_count(), make_edges_mdata_extend(), mesh_calc_edges_mdata(), sph_force_cb(), and TEST().
A version of BLI_edgehash_lookup which accepts a fallback argument.
Definition at line 313 of file edgehash.c.
References edgehash_lookup_entry(), v1, and _EdgeHash_Entry::value.
Referenced by TEST().
Return pointer to value for given edge (v0, v1), or NULL if key does not exist in hash.
Definition at line 335 of file edgehash.c.
References edgehash_lookup_entry(), NULL, v1, and _EdgeHash_Entry::value.
Referenced by TEST(), and test_polyfill_topology().
| EdgeHash* BLI_edgehash_new | ( | const char * | info | ) |
Definition at line 239 of file edgehash.c.
References BLI_edgehash_new_ex(), and CAPACITY_EXP_DEFAULT.
Referenced by cutEdges(), explodeMesh(), TEST(), and test_polyfill_topology().
| EdgeHash* BLI_edgehash_new_ex | ( | const char * | info, |
| const unsigned int | nentries_reserve | ||
| ) |
Definition at line 226 of file edgehash.c.
References calc_capacity_exp_for_reserve(), EdgeHash::capacity_exp, CLEAR_MAP, EdgeHash::dummy_count, EdgeHash::entries, ENTRIES_CAPACITY, EdgeHash::length, EdgeHash::map, MAP_CAPACITY, MEM_calloc_arrayN, MEM_malloc_arrayN, MEM_mallocN, and UPDATE_SLOT_MASK.
Referenced by BKE_mesh_convert_mfaces_to_mpolys_ex(), BKE_mesh_merge_verts(), BKE_mesh_validate_arrays(), BLI_edgehash_new(), ccgDM_copyFinalLoopArray(), customdata_compare(), DRW_displist_indexbuf_create_edges_adjacency_lines(), extract_lines_adjacency_init(), laplacian_system_construct_end(), make_edges_mdata_extend(), mesh_calc_edges_mdata(), sph_springhash_build(), split_faces_prepare_new_edges(), and statvis_calc_sharp().
Remove key (v0, v1) from eh, returning the value or NULL if the key wasn't found.
| v0,v1 | The key to remove. |
Definition at line 401 of file edgehash.c.
References EdgeHash::dummy_count, _EdgeHash_Entry::edge, edgehash_change_index(), EH_INDEX_HAS_EDGE, EdgeHash::entries, init_edge(), ITER_SLOTS, length(), EdgeHash::length, EdgeHash::map, NULL, SLOT_DUMMY, SLOT_EMPTY, v1, and _EdgeHash_Entry::value.
Referenced by BLI_edgehash_remove(), and TEST().
| void BLI_edgehash_print | ( | EdgeHash * | eh | ) |
Definition at line 252 of file edgehash.c.
References _EdgeHash_Entry::edge, EdgeHash::entries, ENTRIES_CAPACITY, EdgeHash::length, EdgeHash::map, MAP_CAPACITY, _EdgeHash_Edge::v_high, _EdgeHash_Edge::v_low, and _EdgeHash_Entry::value.
Assign a new value to a key that may already be in edgehash.
Definition at line 289 of file edgehash.c.
References edgehash_ensure_can_insert(), edgehash_insert(), edgehash_insert_at_slot(), EH_INDEX_HAS_EDGE, EdgeHash::entries, init_edge(), ITER_SLOTS, SLOT_EMPTY, v1, and _EdgeHash_Entry::value.
Referenced by BKE_mesh_poly_edgehash_insert(), cutEdges(), explodeMesh(), and TEST().
| bool BLI_edgehash_remove | ( | EdgeHash * | eh, |
| uint | v0, | ||
| uint | v1, | ||
| EdgeHashFreeFP | free_value | ||
| ) |
Remove key (v0, v1) from eh, or return false if the key wasn't found.
| v0,v1 | The key to remove. |
| free_value | Optional callback to free the value. |
Definition at line 383 of file edgehash.c.
References BLI_edgehash_popkey(), EdgeHash::length, and v1.
Referenced by BKE_mesh_merge_verts(), and TEST().
| void BLI_edgehashIterator_free | ( | EdgeHashIterator * | ehi | ) |
Free an EdgeHashIterator.
Definition at line 496 of file edgehash.c.
References MEM_freeN.
Referenced by cutEdges(), DRW_displist_indexbuf_create_edges_adjacency_lines(), explodeMesh(), extract_lines_adjacency_finish(), make_edges_mdata_extend(), statvis_calc_sharp(), TEST(), and test_polyfill_topology().
| BLI_INLINE void BLI_edgehashIterator_getKey | ( | EdgeHashIterator * | ehi, |
| unsigned int * | r_v0, | ||
| unsigned int * | r_v1 | ||
| ) |
Definition at line 93 of file BLI_edgehash.h.
References _EdgeHash_Entry::edge, EdgeHashIterator::entries, EdgeHashIterator::index, _EdgeHash_Edge::v_high, and _EdgeHash_Edge::v_low.
Referenced by cutEdges(), DRW_displist_indexbuf_create_edges_adjacency_lines(), explodeMesh(), extract_lines_adjacency_finish(), make_edges_mdata_extend(), and statvis_calc_sharp().
| BLI_INLINE void* BLI_edgehashIterator_getValue | ( | EdgeHashIterator * | ehi | ) |
Definition at line 101 of file BLI_edgehash.h.
References EdgeHashIterator::entries, EdgeHashIterator::index, and _EdgeHash_Entry::value.
Referenced by cutEdges(), DRW_displist_indexbuf_create_edges_adjacency_lines(), explodeMesh(), extract_lines_adjacency_finish(), statvis_calc_sharp(), and TEST().
| BLI_INLINE void** BLI_edgehashIterator_getValue_p | ( | EdgeHashIterator * | ehi | ) |
Definition at line 105 of file BLI_edgehash.h.
References EdgeHashIterator::entries, EdgeHashIterator::index, and _EdgeHash_Entry::value.
Referenced by test_polyfill_topology().
| void BLI_edgehashIterator_init | ( | EdgeHashIterator * | ehi, |
| EdgeHash * | eh | ||
| ) |
Init an already allocated EdgeHashIterator. The hash table must not be mutated while the iterator is in use, and the iterator will step exactly BLI_edgehash_len(eh) times before becoming done.
| ehi | The EdgeHashIterator to initialize. |
| eh | The EdgeHash to iterate over. |
Definition at line 486 of file edgehash.c.
References EdgeHashIterator::entries, EdgeHash::entries, EdgeHashIterator::index, EdgeHashIterator::length, and EdgeHash::length.
Referenced by BLI_edgehashIterator_new().
| BLI_INLINE bool BLI_edgehashIterator_isDone | ( | EdgeHashIterator * | ehi | ) |
Definition at line 89 of file BLI_edgehash.h.
References EdgeHashIterator::index, and EdgeHashIterator::length.
Referenced by cutEdges(), DRW_displist_indexbuf_create_edges_adjacency_lines(), explodeMesh(), extract_lines_adjacency_finish(), make_edges_mdata_extend(), statvis_calc_sharp(), TEST(), and test_polyfill_topology().
| EdgeHashIterator* BLI_edgehashIterator_new | ( | EdgeHash * | eh | ) |
Create a new EdgeHashIterator. The hash table must not be mutated while the iterator is in use, and the iterator will step exactly BLI_edgehash_len(eh) times before becoming done.
Definition at line 471 of file edgehash.c.
References BLI_edgehashIterator_init(), and MEM_mallocN.
Referenced by cutEdges(), DRW_displist_indexbuf_create_edges_adjacency_lines(), explodeMesh(), extract_lines_adjacency_finish(), make_edges_mdata_extend(), statvis_calc_sharp(), TEST(), and test_polyfill_topology().
| BLI_INLINE void BLI_edgehashIterator_setValue | ( | EdgeHashIterator * | ehi, |
| void * | val | ||
| ) |
Definition at line 109 of file BLI_edgehash.h.
References EdgeHashIterator::entries, EdgeHashIterator::index, and _EdgeHash_Entry::value.
Referenced by cutEdges(), explodeMesh(), and make_edges_mdata_extend().
| BLI_INLINE void BLI_edgehashIterator_step | ( | EdgeHashIterator * | ehi | ) |
Definition at line 85 of file BLI_edgehash.h.
References EdgeHashIterator::index.
Referenced by cutEdges(), DRW_displist_indexbuf_create_edges_adjacency_lines(), explodeMesh(), extract_lines_adjacency_finish(), make_edges_mdata_extend(), statvis_calc_sharp(), TEST(), and test_polyfill_topology().
A version of BLI_edgeset_insert which checks first if the key is in the set.
Definition at line 578 of file edgehash.c.
References edgeset_ensure_can_insert(), edgeset_insert_at_slot(), ES_INDEX_HAS_EDGE, init_edge(), ITER_SLOTS, SLOT_EMPTY, and v1.
Referenced by BKE_mesh_calc_edges_tessface(), cloth_brush_add_length_constraint(), cloth_build_springs(), ss_sync_from_uv(), and TEST().
| void BLI_edgeset_free | ( | EdgeSet * | es | ) |
Definition at line 529 of file edgehash.c.
References EdgeSet::entries, EdgeSet::map, and MEM_freeN.
Referenced by BKE_mesh_calc_edges_tessface(), cloth_build_springs(), cloth_free_errorsprings(), cloth_free_modifier(), cloth_free_modifier_extern(), SCULPT_cloth_brush_ensure_nodes_constraints(), ss_sync_from_uv(), and TEST().
| bool BLI_edgeset_haskey | ( | EdgeSet * | es, |
| unsigned int | v0, | ||
| unsigned int | v1 | ||
| ) |
Definition at line 611 of file edgehash.c.
References ES_INDEX_HAS_EDGE, init_edge(), ITER_SLOTS, SLOT_EMPTY, and v1.
Referenced by cloth_brush_sim_has_length_constraint(), cloth_build_springs(), cloth_bvh_selfcollision_is_active(), and TEST().
Adds the key to the set (no checks for unique keys!). Matching BLI_edgehash_insert
Definition at line 598 of file edgehash.c.
References edgeset_ensure_can_insert(), edgeset_insert_at_slot(), init_edge(), ITER_SLOTS, SLOT_EMPTY, and v1.
Referenced by cloth_build_springs(), and TEST().
| int BLI_edgeset_len | ( | EdgeSet * | es | ) |
Definition at line 536 of file edgehash.c.
References EdgeSet::length.
Referenced by BKE_mesh_calc_edges_tessface(), and TEST().
| EdgeSet* BLI_edgeset_new | ( | const char * | info | ) |
Definition at line 524 of file edgehash.c.
References BLI_edgeset_new_ex(), and CAPACITY_EXP_DEFAULT.
Referenced by cloth_build_springs(), SCULPT_cloth_brush_ensure_nodes_constraints(), and TEST().
| EdgeSet* BLI_edgeset_new_ex | ( | const char * | info, |
| const unsigned int | nentries_reserve | ||
| ) |
Definition at line 512 of file edgehash.c.
References calc_capacity_exp_for_reserve(), EdgeSet::capacity_exp, CLEAR_MAP, EdgeSet::entries, ENTRIES_CAPACITY, EdgeSet::length, EdgeSet::map, MAP_CAPACITY, MEM_malloc_arrayN, MEM_mallocN, and UPDATE_SLOT_MASK.
Referenced by BKE_mesh_calc_edges_tessface(), BLI_edgeset_new(), cloth_build_springs(), and ss_sync_from_uv().
| void BLI_edgesetIterator_free | ( | EdgeSetIterator * | esi | ) |
Definition at line 634 of file edgehash.c.
References MEM_freeN.
Referenced by BKE_mesh_calc_edges_tessface().
| BLI_INLINE void BLI_edgesetIterator_getKey | ( | EdgeSetIterator * | esi, |
| unsigned int * | r_v0, | ||
| unsigned int * | r_v1 | ||
| ) |
Definition at line 141 of file BLI_edgehash.h.
References EdgeSetIterator::edges, EdgeSetIterator::index, _EdgeHash_Edge::v_high, and _EdgeHash_Edge::v_low.
Referenced by BKE_mesh_calc_edges_tessface().
| BLI_INLINE bool BLI_edgesetIterator_isDone | ( | EdgeSetIterator * | esi | ) |
Definition at line 153 of file BLI_edgehash.h.
References EdgeSetIterator::index, and EdgeSetIterator::length.
Referenced by BKE_mesh_calc_edges_tessface().
| EdgeSetIterator* BLI_edgesetIterator_new | ( | EdgeSet * | es | ) |
Definition at line 625 of file edgehash.c.
References EdgeSetIterator::edges, EdgeSet::entries, EdgeSetIterator::index, EdgeSetIterator::length, EdgeSet::length, and MEM_mallocN.
Referenced by BKE_mesh_calc_edges_tessface().
| BLI_INLINE void BLI_edgesetIterator_step | ( | EdgeSetIterator * | esi | ) |
Definition at line 149 of file BLI_edgehash.h.
References EdgeSetIterator::index.
Referenced by BKE_mesh_calc_edges_tessface().