star-cad

Geometric operators for computer-aided design
git clone git://git.meso-star.fr/star-cad.git
Log | Files | Refs | README | LICENSE

commit 02f61adb2314c48643991b5961f598d42cf7f44c
parent f4945f8de0e8073185b5a478babf7a3668b0776f
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Thu, 27 Oct 2022 09:50:22 +0200

Remove 1 of the 2 add polygon API functions

Diffstat:
Msrc/scad.h | 14+-------------
Msrc/scad_geometry.c | 39+--------------------------------------
2 files changed, 2 insertions(+), 51 deletions(-)

diff --git a/src/scad.h b/src/scad.h @@ -146,22 +146,10 @@ scad_add_disk const double radius, struct scad_geometry** disk); /* Can be NULL: no handler returned. */ -/* Add a polygonal surface in (xy) plane to the scene at elevation z, defined by - * the list of points of coordinates x, y.*/ +/* Add a polygonal surface in (xy) plane to the scene at elevation z */ SCAD_API res_T scad_add_polygon (const char* name, /* Can be NULL */ - const double* x, - const double* y, - const double z, - const size_t count, /* size of x and y arrays */ - struct scad_geometry** polygon); /* Can be NULL: no handler returned. */ - -/* Add a polygonal surface in (xy) plane to the scene at elevation z, defined by - * a functor.*/ -SCAD_API res_T -scad_add_polygon_fun - (const char* name, /* Can be NULL */ void (*get_position)(const size_t ivert, double pos[2], void* data), void* data, /* Custom data */ const double z, diff --git a/src/scad_geometry.c b/src/scad_geometry.c @@ -34,15 +34,6 @@ struct coord_pair { const double* y; }; -static void get_position_pair - (const size_t ivert, double pos[2], void* data) -{ - struct coord_pair* coords = data; - ASSERT(pos && coords); - pos[0] = coords->x[ivert]; - pos[1] = coords->y[ivert]; -} - static res_T scad_geometry_create (const char* name, @@ -422,7 +413,7 @@ error: } res_T -scad_add_polygon_fun +scad_add_polygon (const char* name, void (*get_position)(const size_t ivert, double pos[2], void* data), void* data, @@ -503,34 +494,6 @@ error: } res_T -scad_add_polygon - (const char* name, - const double* x, - const double* y, - const double z, - const size_t count, - struct scad_geometry** out_geometry) -{ - struct coord_pair pair; - res_T res = RES_OK; - - if(!x || !y || count < 3 || !out_geometry) { - res = RES_BAD_ARG; - goto error; - } - - pair.x = x; - pair.y = y; - return scad_add_polygon_fun(name, get_position_pair, &pair, z, count, - out_geometry); - -exit: - return res; -error: - goto exit; -} - -res_T scad_add_box (const char* name, const double xyz[3],