commit 7ddf6f9a5f4959c8690ab4daeb68368407bee819
parent d90cfabc52ea3c213a382d73c8e657c49792163f
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Fri, 6 Feb 2026 11:03:06 +0100
Use double precision for the mesh_decimation_error
In reality, double precision is only used in the API; single precision
is always used internally. This change is primarily intended to prevent
the caller from having to worry about internal precision and having to
manage the conversion.
Diffstat:
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/sln.h b/src/sln.h
@@ -105,7 +105,7 @@ struct sln_tree_create_args {
/* Relative error used to simplify the spectrum mesh. The larger it is, the
* coarser the mesh */
- float mesh_decimation_err; /* > 0 */
+ double mesh_decimation_err; /* > 0 */
enum sln_mesh_type mesh_type; /* Type of mesh to generate */
};
#define SLN_TREE_CREATE_ARGS_DEFAULT__ { \
@@ -124,7 +124,7 @@ static const struct sln_tree_create_args SLN_TREE_CREATE_ARGS_DEFAULT =
struct sln_tree_desc {
size_t max_nlines_per_leaf;
- float mesh_decimation_err;
+ double mesh_decimation_err;
enum sln_mesh_type mesh_type;
enum sln_line_profile line_profile;
};
diff --git a/src/sln_tree_build.c b/src/sln_tree_build.c
@@ -59,7 +59,7 @@ build_leaf_polyline(struct sln_tree* tree, struct sln_node* leaf)
/* Decimate the line mesh */
res = polyline_decimate(tree->sln, darray_vertex_data_get(&tree->vertices),
- vertices_range, tree->args.mesh_decimation_err, tree->args.mesh_type);
+ vertices_range, (float)tree->args.mesh_decimation_err, tree->args.mesh_type);
if(res != RES_OK) goto error;
/* Shrink the size of the vertices */
@@ -161,7 +161,7 @@ merge_node_polylines
/* Decimate the resulting polyline */
res = polyline_decimate(tree->sln, darray_vertex_data_get(&tree->vertices),
- vertices_range, tree->args.mesh_decimation_err, tree->args.mesh_type);
+ vertices_range, (float)tree->args.mesh_decimation_err, tree->args.mesh_type);
if(res != RES_OK) goto error;
/* Shrink the size of the vertices */