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 5aad45ea0cac6050fcc70e7cbbe59e334e45f251
parent a58590a29741ba6c370ade689eaeb459eeef20eb
Author: christophe coustet <christophe.coustet@meso-star.com>
Date:   Thu, 27 Sep 2018 11:22:47 +0200

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

Diffstat:
Msrc/senc_scene_analyze.c | 2--
Msrc/test_senc_enclosure.c | 7+++----
Msrc/test_senc_inconsistant_cube.c | 9++++-----
Msrc/test_senc_scene.c | 2+-
Msrc/test_senc_utils.h | 2+-
5 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/src/senc_scene_analyze.c b/src/senc_scene_analyze.c @@ -875,7 +875,6 @@ build_result const struct triangle_comp* triangles_comp; struct htable_vrtx_id vtable; struct senc_scene* scn; - enum senc_convention convention; int output_normal_in, normals_front, normals_back; int64_t tt; int64_t ee; @@ -884,7 +883,6 @@ build_result alloc = descriptor_get_allocator(desc); scn = desc->scene; - convention = scn->convention; output_normal_in = (scn->convention & SENC_CONVENTION_NORMAL_INSIDE) != 0; normals_front = (scn->convention & SENC_CONVENTION_NORMAL_FRONT) != 0; normals_back = (scn->convention & SENC_CONVENTION_NORMAL_BACK) != 0; diff --git a/src/test_senc_enclosure.c b/src/test_senc_enclosure.c @@ -21,7 +21,7 @@ #include <star/s3d.h> -void +static void test(enum senc_convention convention) { struct mem_allocator allocator; @@ -192,7 +192,7 @@ test(enum senc_convention convention) * of input triangles for enclosure 0 iff convention is inside. * The opposite holds for enclosure 1. */ cmp_trg(n, enclosures[0], box_indices + 3 * n, box_vertices, &same, &reversed); - CHK(same && !reversed == is_in); + CHK((same && !reversed) == is_in); cmp_trg(n, enclosures[1], box_indices + 3 * n, box_vertices, &same, &reversed); CHK(same && reversed == is_in); } @@ -281,4 +281,4 @@ main(int argc, char** argv) test(SENC_CONVENTION_NORMAL_FRONT | SENC_CONVENTION_NORMAL_OUTSIDE); test(SENC_CONVENTION_NORMAL_BACK | SENC_CONVENTION_NORMAL_OUTSIDE); return 0; -} -\ No newline at end of file +} diff --git a/src/test_senc_inconsistant_cube.c b/src/test_senc_inconsistant_cube.c @@ -48,7 +48,7 @@ inconsistant_medium_front[12] = { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static const unsigned inconsistant_medium_back[12] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; -void +static void test(enum senc_convention convention) { struct mem_allocator allocator; @@ -57,7 +57,7 @@ test(enum senc_convention convention) struct senc_scene* scn = NULL; struct senc_enclosure* enclosure; struct senc_enclosure_header header; - enum senc_side_convention conv; + enum senc_convention conv; int conv_front, conv_in; struct context ctx; unsigned i, e, ecount; @@ -114,7 +114,7 @@ test(enum senc_convention convention) front_inside = (conv_front == conv_in); expected_side = front_inside ? 0 : 1; - snprintf(name, sizeof(name), "test_inconsistant_cube_%s_%s_%u.obj", + sprintf(name, "test_inconsistant_cube_%s_%s_%u.obj", conv_front ? "front" : "back", conv_in ? "in" : "out", e); dump_enclosure(desc, e, name); @@ -153,4 +153,4 @@ int main(int argc, char** argv) test(SENC_CONVENTION_NORMAL_BACK | SENC_CONVENTION_NORMAL_OUTSIDE); return 0; -} -\ No newline at end of file +} diff --git a/src/test_senc_scene.c b/src/test_senc_scene.c @@ -31,7 +31,7 @@ main(int argc, char** argv) struct context ctx; unsigned medfront[2], medback[2]; unsigned count, i, maxm; - enum senc_side_convention convention; + enum senc_convention convention; (void)argc, (void)argv; CHK(mem_init_proxy_allocator(&allocator, &mem_default_allocator) == RES_OK); diff --git a/src/test_senc_utils.h b/src/test_senc_utils.h @@ -246,7 +246,7 @@ static INLINE void check_desc(struct senc_descriptor* desc) } /* Compare the itri-th triangle of enclosure with a triangle described by trg2 & vertices2 */ -static void +static INLINE void cmp_trg (const unsigned itri, const struct senc_enclosure* enclosure,