Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/extern
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-05-07 17:02:34 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-05-07 17:04:05 +0300
commite5b4e6b0a3e8d40dc31dec74cfa2c297b3c49a71 (patch)
treeaa000fb24be2eb705ebb8c0027f80c5ad662a898 /extern
parent1c46ecd86b3f5a61fc0392cc2154bdb33273c092 (diff)
Clamp dot-product to avoid precision error
Would only happen in degenerate cases.
Diffstat (limited to 'extern')
-rw-r--r--extern/curve_fit_nd/intern/curve_fit_cubic.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/extern/curve_fit_nd/intern/curve_fit_cubic.c b/extern/curve_fit_nd/intern/curve_fit_cubic.c
index f07bb73429f..8fc7198f891 100644
--- a/extern/curve_fit_nd/intern/curve_fit_cubic.c
+++ b/extern/curve_fit_nd/intern/curve_fit_cubic.c
@@ -419,7 +419,8 @@ static double points_calc_circumference_factor(
const double dot = dot_vnvn(tan_l, tan_r, dims);
const double len_tangent = dot < 0.0 ? len_vnvn(tan_l, tan_r, dims) : len_negated_vnvn(tan_l, tan_r, dims);
if (len_tangent > DBL_EPSILON) {
- double angle = acos(-fabs(dot));
+ /* only clamp to avoid precision error */
+ double angle = acos(max(-fabs(dot), -1.0));
/* Angle may be less than the length when the tangents define >180 degrees of the circle,
* (tangents that point away from each other).
* We could try support this but will likely cause extreme >1 scales which could cause other issues. */