star-cad

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

commit 901a5293163b8083d2594ed84b7e9cafad791f9b
parent b1c61cf2548067d7ecb91381853e7a10e93eac35
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Fri, 25 Nov 2022 16:27:14 +0100

Add new meshing options (and remove an obsolete one)

Diffstat:
Msrc/scad.h | 17+++++++++++++++--
Msrc/scad_device.c | 8++++++--
2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/scad.h b/src/scad.h @@ -54,13 +54,23 @@ enum scad_verbosity_levels { scad_verbosity_debug = 99 }; +/* Mesh algorithms */ +enum scad_mesh_algorithm { + MeshAdapt = 1, + Delaunay = 5, + FrontalDelaunay = 6 +}; + /* A type to specify options for the gmsh library */ struct scad_options { struct { double StlOneSolidPerSurface; + enum scad_mesh_algorithm Algorithm; double MeshSizeFromPoints; double MeshSizeFromCurvature; - double MinimumElementsPerTwoPi; + double MeshSizeMin; + double MeshSizeMax; + double MeshSizeFactor; double MeshSizeExtendFromBoundary; } Mesh; struct { @@ -73,7 +83,10 @@ struct scad_options { }; #define SCAD_DEFAULT_OPTIONS__ \ - { { 2, 0, 1, 36, 0 }, {scad_verbosity_errors}, { 0, 0 }} + { { 2, FrontalDelaunay, 0, 36, 0, 1e+22, 1, 0 }, \ + { scad_verbosity_errors }, \ + { 0, 0 } \ + } static const struct scad_options SCAD_DEFAULT_OPTIONS = SCAD_DEFAULT_OPTIONS__; diff --git a/src/scad_device.c b/src/scad_device.c @@ -117,7 +117,7 @@ check_device if(g_device->options.Misc.Step) { ERR(scad_run_ui()); } - + exit: return res; error: @@ -152,6 +152,7 @@ device_register_tags struct htable_geometries* geoms; char one = 1; if(dim != 2 && dim != 3) { + /* other dims not managed yet */ res = RES_BAD_ARG; goto error; } @@ -327,9 +328,12 @@ scad_set_options keep = dev->options; SET_GMSH_OPTION_DOUBLE(Mesh.StlOneSolidPerSurface); + SET_GMSH_OPTION_INT(Mesh.Algorithm); SET_GMSH_OPTION_DOUBLE(Mesh.MeshSizeFromPoints); SET_GMSH_OPTION_DOUBLE(Mesh.MeshSizeFromCurvature); - SET_GMSH_OPTION_DOUBLE(Mesh.MinimumElementsPerTwoPi); + SET_GMSH_OPTION_DOUBLE(Mesh.MeshSizeMin); + SET_GMSH_OPTION_DOUBLE(Mesh.MeshSizeMax); + SET_GMSH_OPTION_DOUBLE(Mesh.MeshSizeFactor); SET_GMSH_OPTION_DOUBLE(Mesh.MeshSizeExtendFromBoundary); SET_GMSH_OPTION_INT(General.Verbosity);