star-cpr

Clip 2D meshes with 2D polygons
git clone git://git.meso-star.fr/star-cpr.git
Log | Files | Refs | README | LICENSE

commit 9d29d87dc27d1b2bf5b7f503f2bee5bb0a71e2c4
parent 5da0a0368ae784afa09150d8b4cc13ee918dc0f4
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Fri,  3 Nov 2023 14:01:42 +0100

Increase accuracy when writing OBJ files

Diffstat:
Msrc/scpr_polygon.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/scpr_polygon.c b/src/scpr_polygon.c @@ -203,8 +203,8 @@ scpr_polygon_setup_indexed_vertices /* Get count for connex component c */ get_nverts(c, &nverts, data); if(nverts > UINT32_MAX) { - logger_print(polygon->device->logger, LOG_ERROR, - "Too many vertices for component %zu.\n", c); + logger_print(polygon->device->logger, LOG_ERROR, + "Too many vertices for component %zu.\n", c); res = RES_BAD_ARG; goto error; } @@ -721,7 +721,7 @@ scpr_polygon_dump_to_obj tmp64[1] = pt.y; ERR(scpr_device_unscale(polygon->device, tmp64, 2, tmpd)); f2_set_d2(tmpf, tmpd); - fprintf(stream, "v %f %f 0\n", tmpf[0], tmpf[1]); + fprintf(stream, "v %.16g %.16g 0\n", tmpf[0], tmpf[1]); } } @@ -765,7 +765,7 @@ scpr_polygon_dump_component_to_obj tmp64[1] = pt.y; ERR(scpr_device_unscale(polygon->device, tmp64, 2, tmpd)); f2_set_d2(tmpf, tmpd); - fprintf(stream, "v %f %f 0\n", tmpf[0], tmpf[1]); + fprintf(stream, "v %.16g %.16g 0\n", tmpf[0], tmpf[1]); } /* Line */