commit 282c2ab70a54fa16ef600a81f6fda39c74772a72
parent e1292939bedc459bf547d8a196287b5aee11b68c
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Thu, 11 Jul 2024 16:49:48 +0200
Clean previous commit's code
Remove useless code (redundant invalid data detection) and move code
that aborts treatment on some invalid data after a loop VS in the loop
(as this allows to emit a global status message).
Diffstat:
1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/src/scad.c b/src/scad.c
@@ -579,18 +579,13 @@ scad_stl_sort_orientation
res = RES_MEM_ERR;
goto error;
}
- for(e = 0; e < ecount; e++) {
+ /* Triangles of enclosure #0 are also part of other enclosures. To have them
+ * with the expected normal orientation we have to get them from these other
+ * enclosures. */
+ for(e = 1; e < ecount; e++) {
ERR(senc3d_scene_get_enclosure(senc3d_scn, e, &enclosure));
ERR(senc3d_enclosure_get_header(enclosure, &header));
two += (header.primitives_count - header.unique_primitives_count);
- if(e == 0) {
- /* Triangles of enclosure #0 are part of other enclosures. To have them
- * with the expected normal orientation we have to get them from these
- * other enclosures. */
- ERR(senc3d_enclosure_ref_put(enclosure));
- enclosure = NULL;
- continue;
- }
for(i = 0; i < header.unique_primitives_count; i++) {
enum senc3d_side side;
unsigned gid;
@@ -603,14 +598,14 @@ scad_stl_sort_orientation
}
ERR(senc3d_enclosure_ref_put(enclosure));
enclosure = NULL;
- if(two > 0) {
- log_error(get_device(),
- "Triangle set '%s' define an invalid closed volume "
- "(%u / %u triangles with both sides in).\n",
- set_name, (unsigned)two, utcount_in);
- res = RES_BAD_ARG;
- goto error;
- }
+ }
+ if(two > 0) {
+ log_error(get_device(),
+ "Triangle set '%s' define an invalid closed volume "
+ "(%u / %u triangles with both sides in).\n",
+ set_name, (unsigned)two, utcount_in);
+ res = RES_BAD_ARG;
+ goto error;
}
ERR(darray_double_reserve(&new_triangles, 9 * utcount_in));
tin = MEM_CALLOC(allocator, 1, 9 * utcount_in);