star-enclosures-2d

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

commit f6f77a8889830bc24bf5a77045642bd47397fd6f
parent 105d73ae7d54c97e4d19653c923f702356a53639
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Mon,  4 Nov 2019 17:32:31 +0100

Build Linux

Diffstat:
Msrc/senc2d.h | 2++
Msrc/test_senc2d_undefined_medium.c | 8++------
Msrc/test_senc2d_undefined_medium_attr.c | 12++++--------
Msrc/test_senc2d_utils.h | 6+++---
4 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/src/senc2d.h b/src/senc2d.h @@ -18,6 +18,8 @@ #include <rsys/rsys.h> +#include <limits.h> + /* Library symbol management */ #if defined(SENC2D_SHARED_BUILD) #define SENC2D_API extern EXPORT_SYM diff --git a/src/test_senc2d_undefined_medium.c b/src/test_senc2d_undefined_medium.c @@ -33,13 +33,11 @@ test(const int convention) enum senc2d_side side; struct context ctx; unsigned i, s, ecount, vcount, scount; - int is_front, is_in; unsigned media[4]; unsigned rev_box_indices[sizeof(box_indices) / sizeof(*box_indices)]; - int conv_front, conv_in; + int conv_front; conv_front = (convention & SENC2D_CONVENTION_NORMAL_FRONT) != 0; - conv_in = (convention & SENC2D_CONVENTION_NORMAL_INSIDE) != 0; /* Create a box with reversed segments */ FOR_EACH(i, 0, sizeof(rev_box_indices) / sizeof(*rev_box_indices)) { @@ -52,8 +50,6 @@ test(const int convention) OK(senc2d_device_create(NULL, &allocator, SENC2D_NTHREADS_DEFAULT, 1, &dev)); OK(senc2d_scene_create(dev, convention, &scn)); - is_front = (convention & SENC2D_CONVENTION_NORMAL_FRONT) != 0; - is_in = (convention & SENC2D_CONVENTION_NORMAL_INSIDE) != 0; /* A 2D square. * 2 enclosures (inside, outside) sharing the same segments, @@ -241,7 +237,7 @@ test(const int convention) /* Geometrical normals point outside the cube in input segments: * if convention is front, front medium (0) is outside, * that is medium 0's enclosure is infinite */ - CHK(is_front == ((medium == 0) == header.is_infinite)); + CHK(conv_front == ((medium == 0) == header.is_infinite)); CHK(header.segment_count == nsegments); CHK(header.unique_segment_count == nsegments); CHK(header.vertices_count == nvertices); diff --git a/src/test_senc2d_undefined_medium_attr.c b/src/test_senc2d_undefined_medium_attr.c @@ -28,7 +28,7 @@ struct merge_ctx { const unsigned* current_add_interf_data; }; -res_T add_seg +static res_T add_seg (const unsigned global_id, const unsigned iseg, void* context) @@ -48,7 +48,7 @@ res_T add_seg return res; } -res_T merge_seg +static res_T merge_seg (const unsigned global_id, const unsigned iseg, const int reversed_segment, @@ -82,14 +82,12 @@ test(const int convention) enum senc2d_side side; struct context ctx; unsigned i, s, ecount, vcount, scount; - int is_front, is_in; unsigned media[4], interface_ids[4] = { 0, 0, 1, 1, }; unsigned rev_box_indices[sizeof(box_indices) / sizeof(*box_indices)]; - int conv_front, conv_in; + int conv_front; struct merge_ctx merge_ctx; conv_front = (convention & SENC2D_CONVENTION_NORMAL_FRONT) != 0; - conv_in = (convention & SENC2D_CONVENTION_NORMAL_INSIDE) != 0; darray_uint_init(&allocator, &merge_ctx.global_interf_data); merge_ctx.current_add_interf_data = interface_ids; @@ -105,8 +103,6 @@ test(const int convention) OK(senc2d_device_create(NULL, &allocator, SENC2D_NTHREADS_DEFAULT, 1, &dev)); OK(senc2d_scene_create(dev, convention, &scn)); - is_front = (convention & SENC2D_CONVENTION_NORMAL_FRONT) != 0; - is_in = (convention & SENC2D_CONVENTION_NORMAL_INSIDE) != 0; /* A 2D square. * 2 enclosures (inside, outside) sharing the same segments, @@ -300,7 +296,7 @@ test(const int convention) /* Geometrical normals point outside the cube in input segments: * if convention is front, front medium (0) is outside, * that is medium 0's enclosure is infinite */ - CHK(is_front == ((medium == 0) == header.is_infinite)); + CHK(conv_front == ((medium == 0) == header.is_infinite)); CHK(header.segment_count == nsegments); CHK(header.unique_segment_count == nsegments); CHK(header.vertices_count == nvertices); diff --git a/src/test_senc2d_utils.h b/src/test_senc2d_utils.h @@ -85,7 +85,7 @@ static const unsigned medium1_back0[4] = { 1, 1, 1, 0 }; static const unsigned medium1_front0[4] = { 1, 0, 1, 1 }; static INLINE void -get_indices(const unsigned iseg, unsigned ids[2], const void* context) +get_indices(const unsigned iseg, unsigned ids[2], void* context) { const struct context* ctx = context; ASSERT(ids && ctx); @@ -94,7 +94,7 @@ get_indices(const unsigned iseg, unsigned ids[2], const void* context) } static INLINE void -get_position(const unsigned ivert, double pos[2], const void* context) +get_position(const unsigned ivert, double pos[2], void* context) { const struct context* ctx = context; ASSERT(pos && ctx); @@ -103,7 +103,7 @@ get_position(const unsigned ivert, double pos[2], const void* context) } static INLINE void -get_media(const unsigned iseg, unsigned medium[2], const void* context) +get_media(const unsigned iseg, unsigned medium[2], void* context) { const struct context* ctx = context; ASSERT(medium && ctx);