star-cad

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

commit d9d6b7a6588a43a34aad247ca56faa066ee25153
parent 8a50487129140151cdb7ed45d452bd3b56d4baae
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Wed, 24 May 2023 09:12:12 +0200

Remove fragment geometries from API; use geometry partition instead

The reason is that the 2 operators shared the same goal, with fragment lacking overlapping management

Diffstat:
Msrc/scad.h | 9---------
Msrc/scad_geometry.c | 68--------------------------------------------------------------------
2 files changed, 0 insertions(+), 77 deletions(-)

diff --git a/src/scad.h b/src/scad.h @@ -322,15 +322,6 @@ scad_geometries_partition const int allow_overlapping, struct scad_geometry** out_geometries); /* Can be NULL if overlapping disallowed */ -SCAD_API res_T -scad_fragment_geometries - (const char* name, /* Can be NULL */ - struct scad_geometry** geometries, - const size_t geometries_count, - struct scad_geometry** tools, - const size_t tools_count, - struct scad_geometry** out_geometry); - /* Get the boundary of the geometry `geom'. */ SCAD_API res_T scad_geometry_boundary diff --git a/src/scad_geometry.c b/src/scad_geometry.c @@ -1639,74 +1639,6 @@ error: } res_T -scad_fragment_geometries - (const char* name, - struct scad_geometry** geometries, - const size_t geometries_count, - struct scad_geometry** tools, - const size_t tools_count, - struct scad_geometry** out_geometry) -{ - res_T res = RES_OK; - int* tagout = NULL; - int** map = NULL; - size_t* mapn = NULL; - size_t tagoutn, mapnn = 0, sz1, sz2; - int* data1 = NULL; - int* data2 = NULL; - int ierr = 0; - struct scad_geometry* geom = NULL; - struct scad_device* dev = get_device(); - struct mem_allocator* allocator = NULL; - - if(!geometries || !geometries_count || !tools || !tools_count || !out_geometry) { - res = RES_BAD_ARG; - goto error; - } - - ERR(check_device(FUNC_NAME)); - allocator = dev->allocator; - - ERR(gather_tags(geometries, geometries_count, &data1, &sz1)); - ERR(gather_tags(tools, tools_count, &data2, &sz2)); - - /* We don't remove gmsh objects here; they are only removed when their tags are - * no longuer used by any star-cad geometry */ - gmshModelOccFragment(data1, sz1, data2, sz2, &tagout, &tagoutn, &map, &mapn, - &mapnn, -1, 0, 0, &ierr); - ERR(gmsh_err_to_res_T(ierr)); - - ERR(scad_geometry_create(name, &geom)); - geom->gmsh_dimTags_n = tagoutn; - geom->gmsh_dimTags = MEM_ALLOC(allocator, tagoutn * sizeof(*tagout)); - if(!geom->gmsh_dimTags) { - res = RES_MEM_ERR; - goto error; - } - memcpy(geom->gmsh_dimTags, tagout, tagoutn * sizeof(*tagout)); - - ERR(device_register_tags(geom)); - -exit: - if(out_geometry) *out_geometry = geom; - if(allocator) { - MEM_RM(allocator, data1); - MEM_RM(allocator, data2); - } - gmshFree(mapn); - gmshFree(tagout); - free_gmsh_map(map, mapnn); - return res; -error: - if(geom) { - SCAD(geometry_ref_put(geom)); - geom = NULL; - } - if(tagout) gmshModelOccRemove(tagout, tagoutn, 1, &ierr); - goto exit; -} - -res_T scad_geometry_boundary (const char* name, struct scad_geometry** geometries,