commit 073ae902fe95f2e622baa07bc5985f16c6b6678e
parent 6165f0c5806034e4fc64fec8dabaac92df0da329
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Mon, 7 Sep 2026 16:06:30 +0200
Merge branch 'release_0.4'
Diffstat:
4 files changed, 27 insertions(+), 22 deletions(-)
diff --git a/README.md b/README.md
@@ -10,11 +10,11 @@ development effort funded by [Ademe](https://www.ademe.fr/) is ongoing.
## How to build
-This library, as part of the Solstice app, can be built on any POSIX system.
+This library, as part of the Solstice app, can be built on any x86-64 POSIX system.
Note that you will most likely want to build the entire Solstice app rather than
-this library alone. If so, a good starting point is the
-[start-build](https://gitlab.com/meso-star/star-build) build system.
+this library alone. If so, a good starting point is the dedicated
+[Solstice web page](https://www.meso-star.com/solstice/install.html).
The Solstice-Anim library relies on the [RSys](https://gitlab.com/vaplv/rsys/)
library, and on the [OpenMP](http://www.openmp.org) 1.2 specification to
@@ -29,6 +29,14 @@ the project by running:
## Release notes
+### Version 0.4
+
+- Fix some algorithm thresholds.
+ Fix threshold preventing difficult but possible tracking.
+ The previous threshold seemed too high; the new one is low enough to
+ accommodate a real-world situation that triggered this fix.
+
+
### Version 0.3
Replace CMake with a POSIX Makefile
diff --git a/config.mk b/config.mk
@@ -1,5 +1,5 @@
VERSION_MAJOR = 0
-VERSION_MINOR = 3
+VERSION_MINOR = 4
VERSION_PATCH = 0
VERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)
diff --git a/src/sanim_node.c b/src/sanim_node.c
@@ -24,6 +24,11 @@
#include <math.h>
+/* This constant is used as a minimum length for the 2D projection of normalized
+ * 3D vectors: a shorter length means that computations on the 2D projections
+ * can no longer be performed. */
+#define MIN_2D_PROJ 0.05
+
/*******************************************************************************
* Helper functions
******************************************************************************/
@@ -59,14 +64,6 @@ d34_muld34(double dst[12], const double a[12], const double b[12])
d33_muld33(dst, a, b);
}
-static INLINE void
-d34_set_identity(double dst[12])
-{
- ASSERT(dst);
- d33_set_identity(dst);
- d3_splat(dst + 9, 0);
-}
-
static double*
get_Xpivot_transform
(const double angle,
@@ -267,7 +264,7 @@ pivot_solve_single_axis_sun
d33_muld3(local_in, inv, in_dir);
/* solve in the YZ plane */
- if (d2_normalize(local_in_2D, local_in + 1) < 0.25) {
+ if (d2_normalize(local_in_2D, local_in + 1) < MIN_2D_PROJ) {
/* not really in the YZ-plane */
return RES_BAD_ARG;
}
@@ -314,7 +311,7 @@ pivot_solve_single_axis_line(struct sanim_node* node, const double in_dir[3])
d33_transpose(inv, mat); /* no scale factors: inverse is transpose */
d33_muld3(local_in, inv, in_dir);
/* solve in the YZ plane */
- if (d2_normalize(local_in_2D, local_in + 1) < 0.25) {
+ if (d2_normalize(local_in_2D, local_in + 1) < MIN_2D_PROJ) {
/* not really in the YZ-plane */
return RES_BAD_ARG;
}
@@ -356,7 +353,7 @@ pivot_solve_single_axis_line(struct sanim_node* node, const double in_dir[3])
double pivot[4];
/* compute 2D normal after rotation */
d2_sub(local_out_2D, local_target_2D, ref_point_2D);
- if (d2_normalize(local_out_2D, local_out_2D) < 0.25) {
+ if (d2_normalize(local_out_2D, local_out_2D) < MIN_2D_PROJ) {
/* not really in the YZ-plane */
return RES_BAD_ARG;
}
@@ -380,7 +377,7 @@ pivot_solve_single_axis_line(struct sanim_node* node, const double in_dir[3])
if (d2) {
/* only if ref_point is not the rotation point
- * the heuristic is to amortize algorithm's oscillations */
+ * the heuristic is to amortize algorithm's oscillations */
sign_dA = sign(previous_angle - angle);
if (prev_sign_dA != sign_dA)
kA *= 0.9;
@@ -407,9 +404,9 @@ pivot_solve_single_axis_dir
{
double mat[12], inv[12];
double local_in[3], local_out[3];
- double local_in_2D[2] = {0, 0};
- double rotated_n_2D[2] = {0, 0};
- double local_out_2D[2] = {0, 0};
+ double local_in_2D[2];
+ double rotated_n_2D[2];
+ double local_out_2D[2];
const double* ref_normal_2D;
struct pivot_data* pivot_data;
ASSERT(node && node->data && in_dir);
@@ -431,11 +428,11 @@ pivot_solve_single_axis_dir
d33_muld3(local_out, inv, pivot_data->tracking.data.out_dir.u);
/* solve in the YZ plane */
- if (d2_normalize(local_in_2D, local_in + 1) < 0.25) {
+ if (d2_normalize(local_in_2D, local_in + 1) < MIN_2D_PROJ) {
/* not really in the YZ-plane */
return RES_BAD_ARG;
}
- if (d2_normalize(local_out_2D, local_out + 1) < 0.25) {
+ if (d2_normalize(local_out_2D, local_out + 1) < MIN_2D_PROJ) {
/* not really in the YZ-plane */
return RES_BAD_ARG;
}
diff --git a/src/test_sanim_node_pivot.c b/src/test_sanim_node_pivot.c
@@ -67,7 +67,7 @@ main(int argc, char** argv)
CHK(my_type_set_translation(t2, transl) == RES_OK);
CHK(my_type_set_translation(t3, transl) == RES_OK);
- d3(in_dir, 0, 0.99, -0.1);
+ d3(in_dir, 0, 0.9999, -0.01);
/* rotation axis is Y after positioning: cannot accomodate in_dir */
CHK(my_type_solve_pivot(t2, in_dir) == RES_BAD_ARG);