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 7b383fac9ba04ff7070dd274cefbc2f4fec52c5e
parent e9ba9d9e9c5a464d7ec512fc2d2d6990997c729d
Author: christophe coustet <christophe.coustet@meso-star.com>
Date:   Thu, 27 Sep 2018 11:54:41 +0200

Merge remote-tracking branch 'origin/feature_normal_convention' into develop

Diffstat:
Msrc/senc2d_scene_analyze.c | 2--
Msrc/test_senc2d_enclosure.c | 7+++----
Msrc/test_senc2d_inconsistant_square.c | 15+++++++--------
Msrc/test_senc2d_scene.c | 2+-
Msrc/test_senc2d_utils.h | 2+-
5 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/src/senc2d_scene_analyze.c b/src/senc2d_scene_analyze.c @@ -835,7 +835,6 @@ build_result const struct segment_comp* segments_comp; struct htable_vrtx_id vtable; struct senc2d_scene* scn; - enum senc2d_convention convention; int output_normal_in, normals_front, normals_back; int64_t sg; int64_t ee; @@ -844,7 +843,6 @@ build_result alloc = descriptor_get_allocator(desc); scn = desc->scene; - convention = scn->convention; output_normal_in = (scn->convention & SENC2D_CONVENTION_NORMAL_INSIDE) != 0; normals_front = (scn->convention & SENC2D_CONVENTION_NORMAL_FRONT) != 0; normals_back = (scn->convention & SENC2D_CONVENTION_NORMAL_BACK) != 0; diff --git a/src/test_senc2d_enclosure.c b/src/test_senc2d_enclosure.c @@ -21,7 +21,7 @@ #include <star/s2d.h> -void +static void test(enum senc2d_convention convention) { struct mem_allocator allocator; @@ -191,7 +191,7 @@ test(enum senc2d_convention convention) * of input segments for enclosure 0 iff convention is inside. * The opposite holds for enclosure 1. */ cmp_seg(n, enclosures[0], box_indices + 2 * n, box_vertices, &same, &reversed); - CHK(same && !reversed == is_in); + CHK((same && !reversed) == is_in); cmp_seg(n, enclosures[1], box_indices + 2 * n, box_vertices, &same, &reversed); CHK(same && reversed == is_in); } @@ -281,4 +281,4 @@ main(int argc, char** argv) test(SENC2D_CONVENTION_NORMAL_FRONT | SENC2D_CONVENTION_NORMAL_OUTSIDE); test(SENC2D_CONVENTION_NORMAL_BACK | SENC2D_CONVENTION_NORMAL_OUTSIDE); return 0; -} -\ No newline at end of file +} diff --git a/src/test_senc2d_inconsistant_square.c b/src/test_senc2d_inconsistant_square.c @@ -21,11 +21,11 @@ /* The following array lists the indices toward the 2D vertices of each * segment. - * Y + * Y * 2----3 | - * | | 0----X - * | | - * 0----1 + * | | 0----X + * | | + * 0----1 */ /* Segment #1 order is not consistant with other segments */ static unsigned inconsistant_box_indices[4/*#segments*/ * 2/*#indices per segment*/] = { @@ -43,7 +43,7 @@ inconsistant_medium_front[4] = { 1, 0, 0, 0 }; static const unsigned inconsistant_medium_back[4] = { 0, 1, 1, 1 }; -void +static void test(enum senc2d_convention convention) { struct mem_allocator allocator; @@ -109,7 +109,7 @@ test(enum senc2d_convention convention) front_inside = (conv_front == conv_in); expected_side = front_inside ? 0 : 1; - snprintf(name, sizeof(name), "test_inconsistant_square_%s_%s_%u.obj", + sprintf(name, "test_inconsistant_square_%s_%s_%u.obj", conv_front ? "front" : "back", conv_in ? "in" : "out", e); dump_enclosure(desc, e, name); @@ -147,4 +147,4 @@ int main(int argc, char** argv) test(SENC2D_CONVENTION_NORMAL_FRONT | SENC2D_CONVENTION_NORMAL_OUTSIDE); test(SENC2D_CONVENTION_NORMAL_BACK | SENC2D_CONVENTION_NORMAL_OUTSIDE); return 0; -} -\ No newline at end of file +} diff --git a/src/test_senc2d_scene.c b/src/test_senc2d_scene.c @@ -31,7 +31,7 @@ main(int argc, char** argv) struct context ctx; unsigned medfront[2], medback[2]; unsigned count, i, maxm; - enum senc2d_side_convention convention; + enum senc2d_convention convention; (void)argc, (void)argv; CHK(mem_init_proxy_allocator(&allocator, &mem_default_allocator) == RES_OK); diff --git a/src/test_senc2d_utils.h b/src/test_senc2d_utils.h @@ -276,7 +276,7 @@ static INLINE void check_desc(struct senc2d_descriptor* desc) } /* Compare the itri-th segment of enclosure with a segment described by seg2 & vertices2 */ -static void +static INLINE void cmp_seg (const unsigned iseg, const struct senc2d_enclosure* enclosure,