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 00b401cd586b47fa9bfa7a316b6ae428b94739eb
parent 13e9691f2150dd5565f2ddabd1efe695061cd859
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Wed, 22 Jul 2020 17:59:38 +0200

Better fix for broken enclosure whith multiple media inside

Diffstat:
Msrc/senc3d_scene_analyze.c | 21+++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/src/senc3d_scene_analyze.c b/src/senc3d_scene_analyze.c @@ -286,8 +286,6 @@ extract_connex_components side_id_t max_nz_side_id; const side_id_t last_side = media_use->last; int component_canceled = 0, max_z_is_2sided = 0, fst_nz = 1; - side_id_t cc_start_side_id = SIDE_NULL__; - side_id_t cc_last_side_id = SIDE_NULL__; res_T tmp_res = RES_OK; ATOMIC id; @@ -297,9 +295,15 @@ extract_connex_components ASSERT(first_side_not_in_component < 2 * scn->ntris); ASSERT(darray_side_id_size_get(&stack) == 0); ASSERT(darray_side_id_size_get(&current_component) == 0); - for(;;) { /* Process all components for this medium */ + for(;;) { + /* Process all components for this medium + * Here we start from a side of the currently processed medium that is + * not member of any component yet; by exploring neighbourhood the + * process can harvest sides with different media */ side_id_t crt_side_id = get_side_not_in_connex_component (last_side, trgsides, processed, &first_side_not_in_component, medium); + side_id_t cc_start_side_id = crt_side_id; + side_id_t cc_last_side_id = crt_side_id; vrtx_id_t max_z_vrtx_id = VRTX_NULL__; struct cc_descriptor *cc; double max_z = -DBL_MAX; @@ -311,13 +315,6 @@ extract_connex_components if(crt_side_id == SIDE_NULL__) break; /* start_side_id=SIDE_NULL__ => component done! */ - if(cc_start_side_id == SIDE_NULL__) { - cc_start_side_id = cc_last_side_id = crt_side_id; - } else { - cc_start_side_id = MMIN(cc_start_side_id, crt_side_id); - cc_last_side_id = MMAX(cc_last_side_id, crt_side_id); - } - #ifndef NDEBUG { trg_id_t tid = TRGSIDE_2_TRG(crt_side_id); @@ -455,10 +452,6 @@ extract_connex_components cc->media = current_media; current_media = NULL; - /* Reset for next component */ - cc_start_side_id = SIDE_NULL__; - cc_last_side_id = SIDE_NULL__; - /* Write component membership in the global structure * No need for sync here as an unique thread writes a given side */ {STATIC_ASSERT(sizeof(cc->cc_id) >= 4, Cannot_write_IDs_sync_free);}