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 d65eb65b9004c90f494282f860fe17eeeed07c58
parent 2699ef9fe4cf1d8c5c420536cde9df7413d04678
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Tue,  3 Mar 2020 15:14:33 +0100

Small changes in asserts

Diffstat:
Msrc/senc3d_sXd_helper.h | 35++++++++++++++---------------------
1 file changed, 14 insertions(+), 21 deletions(-)

diff --git a/src/senc3d_sXd_helper.h b/src/senc3d_sXd_helper.h @@ -19,7 +19,6 @@ #include "senc3d.h" #include <rsys/rsys.h> -#include <rsys/float3.h> /* Get vertex indices for the itri_th triangle. * Suitable for use as get_indice callback in s3d_mesh_setup_indexed_vertices @@ -27,14 +26,12 @@ static FINLINE void senc3d_sXd_scene_get_indices (const unsigned itri, - unsigned indices[3], + unsigned indices[SENC3D_GEOMETRY_DIMENSION], void* ctx) { const struct senc3d_scene* scene = ctx; - res_T r; ASSERT(indices && scene); - r = senc3d_scene_get_triangle(scene, itri, indices); - ASSERT(r == RES_OK); (void)r; + SENC3D(scene_get_triangle(scene, itri, indices)); } /* Get coordinates for the ivert_th vertex. @@ -43,16 +40,15 @@ senc3d_sXd_scene_get_indices static FINLINE void senc3d_sXd_scene_get_position (const unsigned ivert, - float coord[3], + float coord[SENC3D_GEOMETRY_DIMENSION], void* ctx) { const struct senc3d_scene* scene = ctx; - double tmp[3]; - res_T r; + double tmp[SENC3D_GEOMETRY_DIMENSION]; + int i; ASSERT(coord && scene); - r = senc3d_scene_get_vertex(scene, ivert, tmp); - ASSERT(r == RES_OK); (void)r; - f3_set_d3(coord, tmp); + SENC3D(scene_get_vertex(scene, ivert, tmp)); + FOR_EACH(i, 0, SENC3D_GEOMETRY_DIMENSION) coord[i] = (float)tmp[i]; } /* Get vertex indices for the itri_th triangle of the enclosure. @@ -61,14 +57,12 @@ senc3d_sXd_scene_get_position static FINLINE void senc3d_sXd_enclosure_get_indices (const unsigned itri, - unsigned indices[3], + unsigned indices[SENC3D_GEOMETRY_DIMENSION], void* ctx) { const struct senc3d_enclosure* enclosure = ctx; - res_T r; ASSERT(indices && ctx); - r = senc3d_enclosure_get_triangle(enclosure, itri, indices); - ASSERT(r == RES_OK); (void)r; + SENC3D(enclosure_get_triangle(enclosure, itri, indices)); } /* Get coordinates for the ivert_th vertex of the enclosure. @@ -77,16 +71,15 @@ senc3d_sXd_enclosure_get_indices static FINLINE void senc3d_sXd_enclosure_get_position (const unsigned ivert, - float coord[3], + float coord[SENC3D_GEOMETRY_DIMENSION], void* ctx) { const struct senc3d_enclosure* enclosure = ctx; - double tmp[3]; - res_T r; + double tmp[SENC3D_GEOMETRY_DIMENSION]; + int i; ASSERT(coord && ctx); - r = senc3d_enclosure_get_vertex(enclosure, ivert, tmp); - ASSERT(r == RES_OK); (void)r; - f3_set_d3(coord, tmp); + SENC3D(enclosure_get_vertex(enclosure, ivert, tmp)); + FOR_EACH(i, 0, SENC3D_GEOMETRY_DIMENSION) coord[i] = (float)tmp[i]; } #endif /* SENC3D_S3D_WRAPPER_H */