star-enclosures-3d

Extract enclosures from 3D geometry
git clone git://git.meso-star.fr/star-enclosures-3d.git
Log | Files | Refs | README | LICENSE

commit ce25c6cc1cadb5cd3600c7e278d635f609cf325c
parent 6b52a3647e23ae9b3a3b8810f8c0881c62ecf630
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Fri, 12 Jun 2020 18:26:34 +0200

Ensure overlapping triangles' ids are sorted

Diffstat:
Msrc/senc3d_internal_types.h | 8++++++++
Msrc/senc3d_scene_analyze.c | 4++++
2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/senc3d_internal_types.h b/src/senc3d_internal_types.h @@ -61,6 +61,14 @@ typedef unsigned trg_id_t; #define TRG_MAX__ (UINT_MAX/2) #define TRG_NULL__ UINT_MAX #define PRTF_TRG "%u" +static INLINE int +cmp_trg_id + (const void* ptr1, const void* ptr2) +{ + const trg_id_t* t1 = ptr1; + const trg_id_t* t2 = ptr2; + return (*t1) - (*t2); +} /* Side IDs type use the same base type than Trg IDs */ typedef trg_id_t side_id_t; diff --git a/src/senc3d_scene_analyze.c b/src/senc3d_scene_analyze.c @@ -1049,6 +1049,10 @@ collect_and_link_neighbours htable_overlap_iterator_key_get(&it)); htable_overlap_iterator_next(&it); } + qsort(darray_trg_id_data_get(&scn->analyze.overlapping_ids), + darray_trg_id_size_get(&scn->analyze.overlapping_ids), + sizeof(*darray_trg_id_cdata_get(&scn->analyze.overlapping_ids)), + cmp_trg_id); } tmp_error: