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 18bbe2e6e8b024f826444f62eb122475be90fc30
parent 462e39a5b33b73c773dd2909f9be3536ac620efc
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Thu, 31 Aug 2023 11:15:52 +0200

Spacing

Diffstat:
Msrc/senc3d.h | 2+-
Msrc/senc3d_scene_analyze.c | 28++++++++++++++--------------
Msrc/test_senc3d_cube_behind_cube.c | 2+-
Msrc/test_senc3d_enclosure.c | 2+-
Msrc/test_senc3d_scene.c | 2+-
Msrc/test_senc3d_unspecified_medium.c | 4++--
6 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/senc3d.h b/src/senc3d.h @@ -94,7 +94,7 @@ struct senc3d_enclosure_header { * If the two sides of a triangle are part of the enclosure, the triangle is * counted as 0. */ double volume; - /* The area of the enclosure, in m^2. + /* The area of the enclosure, in m^2. * If the two sides of a triangle are part of the enclosure, the triangle is * counted twice. */ double area; diff --git a/src/senc3d_scene_analyze.c b/src/senc3d_scene_analyze.c @@ -44,12 +44,12 @@ { TRG_NULL__, 0}\ } #ifdef COMPILER_GCC - #pragma GCC diagnostic push + #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmissing-field-initializers" #endif const struct cc_descriptor CC_DESCRIPTOR_NULL = CC_DESCRIPTOR_NULL__; #ifdef COMPILER_GCC - #pragma GCC diagnostic pop + #pragma GCC diagnostic pop #endif #define DARRAY_NAME component_id @@ -226,7 +226,7 @@ self_hit_filter return 1; /* Reject */ if(hit->distance == 0) { - /* origin_component is in contact with some other components + /* origin_component is in contact with some other components * We will need further exploration to know if they should be considered */ struct cc_descriptor* const* descriptors = darray_ptr_component_descriptor_cdata_get(fctx->components); @@ -311,10 +311,10 @@ self_hit_filter } /* Reject hits with < Z */ - ASSERT(hit->prim.prim_id < + ASSERT(hit->prim.prim_id < darray_triangle_in_size_get(&fctx->scn->triangles_in)); trg = triangles + hit->prim.prim_id; - /* Check if the hit is above ray_org (hit[2] > ray_org[2]) + /* Check if the hit is above ray_org (hit[2] > ray_org[2]) * As we cannot rely on numerical accuracy when computing hit positions, * we use the triangle vertices to check if some part of the hit triangle * is above ray_org */ @@ -345,7 +345,7 @@ self_hit_filter } /* We cannot know which side to consider if s==0. - * As hit distance > 0 and the 2 sides belong to 2 different components, + * As hit distance > 0 and the 2 sides belong to 2 different components, * another candidate must selected afterwards (can be at greater distance, * disallowing to restrict the search distance here) */ if(s == 0) { @@ -461,7 +461,7 @@ extract_connex_components 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 + * 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); @@ -560,7 +560,7 @@ extract_connex_components * id and recancel all the work in progress */ component_canceled = 1; darray_side_id_clear(&stack); - /* Don't cancel used flags as all these sides will get us back to + /* Don't cancel used flags as all these sides will get us back to * (at least) the neighbour side we have just discovered, that will * cancel them again and again */ sz = darray_side_id_size_get(&current_component); @@ -818,7 +818,7 @@ compare_components static res_T reorder_components - (struct senc3d_scene* scn, + (struct senc3d_scene* scn, struct darray_ptr_component_descriptor* connex_components, struct darray_triangle_comp* triangles_comp_array) { @@ -1075,7 +1075,7 @@ collect_and_link_neighbours vertices = darray_position_cdata_get(&scn->vertices); ASSERT(scn->ntris == darray_triangle_tmp_size_get(triangles_tmp_array)); - + /* Make some room for edges. */ nbedges_guess = 4 + (thread_count == 1 ? (edge_id_t)(scn->nverts + scn->ntris) @@ -1347,7 +1347,7 @@ reorder_enclosures ASSERT(new_id < scn->analyze.enclosures_count); cc_descriptors[c]->enclosure_id = new_id; } -error: +error: if(new_ids) MEM_RM(scn->dev->allocator, new_ids); return res; } @@ -1460,7 +1460,7 @@ build_result if(*res != RES_OK) continue; ASSERT(e <= ENCLOSURE_MAX__); enc->header.enclosure_id = (unsigned)ee; /* Back to API type */ - ASSERT(cc_descriptors[enc->first_component]->enclosure_id + ASSERT(cc_descriptors[enc->first_component]->enclosure_id == enc->header.enclosure_id); enc->header.is_infinite = (e == 0); @@ -1610,7 +1610,7 @@ scene_analyze ATOMIC next_enclosure_id = 1; res_T res = RES_OK; res_T res2 = RES_OK; - + if(!scn) return RES_BAD_ARG; if(!scn->ntris) goto exit; @@ -1724,7 +1724,7 @@ scene_analyze #pragma omp barrier /* Constraints on step 2 data are now met */ - + if(res != RES_OK) { #pragma omp single nowait { diff --git a/src/test_senc3d_cube_behind_cube.c b/src/test_senc3d_cube_behind_cube.c @@ -257,7 +257,7 @@ main(int argc, char** argv) SENC3D_CONVENTION_NORMAL_FRONT | SENC3D_CONVENTION_NORMAL_INSIDE, cube_behind_cube_2_triangles_count, get_indices, get_media_from_properties, cube_behind_cube_2_vertices_count, get_position, &ctx, &scn)); - + OK(senc3d_scene_get_enclosure_count(scn, &ecount)); CHK(ecount == 3); diff --git a/src/test_senc3d_enclosure.c b/src/test_senc3d_enclosure.c @@ -65,7 +65,7 @@ test(const int convention) OK(senc3d_scene_get_enclosure_count(scn, &count)); CHK(count == 2); - + OK(senc3d_scene_get_enclosure(scn, 0, &enclosure)); BA(senc3d_enclosure_ref_get(NULL)); OK(senc3d_enclosure_ref_get(enclosure)); diff --git a/src/test_senc3d_scene.c b/src/test_senc3d_scene.c @@ -90,7 +90,7 @@ main(int argc, char** argv) BA(senc3d_scene_get_triangles_count(NULL, NULL)); OK(senc3d_scene_get_triangles_count(scn, &count)); CHK(count == ntriangles); - + BA(senc3d_scene_get_vertices_count(NULL, &count)); BA(senc3d_scene_get_vertices_count(scn, NULL)); BA(senc3d_scene_get_vertices_count(NULL, NULL)); diff --git a/src/test_senc3d_unspecified_medium.c b/src/test_senc3d_unspecified_medium.c @@ -178,7 +178,7 @@ test(const int convention) OK(mem_init_proxy_allocator(&allocator, &mem_default_allocator)); OK(senc3d_device_create(NULL, &allocator, SENC3D_NTHREADS_DEFAULT, 1, &dev)); - + /* Geometry with no media information on both sides */ ctx.positions = front_unspecified_vertices; ctx.indices = front_unspecified_triangles; @@ -207,7 +207,7 @@ test(const int convention) expected_external_medium = conv_front ? SENC3D_UNSPECIFIED_MEDIUM : 1; expected_internal_medium = conv_front ? 1 : SENC3D_UNSPECIFIED_MEDIUM; - CHK(medium == (header.is_infinite + CHK(medium == (header.is_infinite ? expected_external_medium : expected_internal_medium)); CHK(header.primitives_count == ntriangles); CHK(header.unique_primitives_count == ntriangles);