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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-08-13 12:38:19 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-08-13 12:45:01 +0300
commit4cadccebfacfa8533ba06403960e8b1218da61f5 (patch)
treeeed8e2f5d0c4dc08d6deebc00392bb1e03d9bc26 /source/blender/blenlib
parentb9486c39bcd57098b2baf8fb5d69088768a88e35 (diff)
Revert "Mesh: replace saacos with acosf for normal calculation"
This reverts commit 41e650981861c2f18ab0548e18851d1d761066ff. This broke "CubeMaskFirst" test. Any value even slightly outside the [-1.0..1.0] range caused the result to be nan, which can happen when calculating the dot-product between two unit length vectors.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/math_geom.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 43f2e08cf69..8afb6b5a2be 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -5307,10 +5307,7 @@ void accumulate_vertex_normals_tri_v3(float n1[3],
for (i = 0; i < nverts; i++) {
const float *cur_edge = vdiffs[i];
- /* Calculate angle between the two poly edges incident on this vertex.
- * NOTE: no need for #saacos here as the input has been sanitized,
- * `nan` values in coordinates normalize to zero which works for `acosf`. */
- const float fac = acosf(-dot_v3v3(cur_edge, prev_edge));
+ const float fac = saacos(-dot_v3v3(cur_edge, prev_edge));
/* accumulate */
madd_v3_v3fl(vn[i], f_no, fac);
@@ -5389,10 +5386,9 @@ void accumulate_vertex_normals_poly_v3(float **vertnos,
for (i = 0; i < nverts; i++) {
const float *cur_edge = vdiffs[i];
- /* Calculate angle between the two poly edges incident on this vertex.
- * NOTE: no need for #saacos here as the input has been sanitized,
- * `nan` values in coordinates normalize to zero which works for `acosf`. */
- const float fac = acosf(-dot_v3v3(cur_edge, prev_edge));
+ /* calculate angle between the two poly edges incident on
+ * this vertex */
+ const float fac = saacos(-dot_v3v3(cur_edge, prev_edge));
/* accumulate */
madd_v3_v3fl(vertnos[i], polyno, fac);