commit c0df844ca137b63389ad55f940bb3602c09f9af8
parent d136a2d670bb6d843773af6a665ead9cf2a8f54e
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Fri, 3 Jul 2020 17:53:37 +0200
Bugfix: enclosures with Ny=0 everywhere are broken
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/senc2d_scene_analyze.c b/src/senc2d_scene_analyze.c
@@ -209,7 +209,7 @@ extract_connex_components
double max_ny;
side_id_t max_ny_side_id;
const side_id_t last_side = media_use->last;
- int component_canceled = 0, max_y_is_2sided = 0;
+ int component_canceled = 0, max_y_is_2sided = 0, fst_ny = 1;
res_T tmp_res = RES_OK;
ATOMIC id;
@@ -391,6 +391,7 @@ extract_connex_components
/* Compute component area and volume, and record information on the
* max_y side of the component to help find out if the component is
* inner or outer */
+ fst_ny = 1;
max_ny = 0;
max_ny_side_id = SIDE_NULL__;
FOR_EACH(ii, 0, sz) {
@@ -438,19 +439,21 @@ extract_connex_components
ASSERT(seg_comp->component[side] != COMPONENT_NULL__); (void)side;
if(seg_tmp->max_y == max_y) {
int i;
- /* candidate to define the max_y normal */
+ /* Candidate to define the max_ny (segment using max_y_vrtx) */
FOR_EACH(i, 0, 2) {
if(cc->max_y_vrtx_id == seg_in->vertice_id[i]) {
- if(fabs(normal[1]) > fabs(max_ny)) {
+ if(fst_ny || fabs(normal[1]) > fabs(max_ny)) {
max_ny_side_id = s_id;
max_ny = normal[1];
max_y_is_2sided = is_2sided;
+ fst_ny = 0;
break;
}
}
}
}
}
+ ASSERT(!fst_ny);
/* Determine if this component can be an inner part inside another
* component (substracting a volume) as only these components will need
* to search for their possible outer component when grouping