cleanup: remove "sa" acos/asin/sqrt functions and use "safe_" variants
Cleanup talked about in the previous semi-related PR, #114501 - saacos, saasin, sasqrt have been 100% identical to saacosf, saasinf, sasqrtf since 2012. - For all the above, there exist more intuitively named safe_acosf, safe_asinf, safe_sqrtf that do the same thing, so switch all code to those. Pull Request: https://projects.blender.org/blender/blender/pulls/114593
This commit is contained in:
committed by
Aras Pranckevicius
parent
7c68e9a94c
commit
13dbeac13c
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "mathutils.h"
|
||||
|
||||
#include "BLI_math_base_safe.h"
|
||||
#include "BLI_math_matrix.h"
|
||||
#include "BLI_math_rotation.h"
|
||||
#include "BLI_math_vector.h"
|
||||
@@ -1448,7 +1449,7 @@ static PyObject *Quaternion_angle_get(QuaternionObject *self, void * /*closure*/
|
||||
|
||||
normalize_qt_qt(tquat, self->quat);
|
||||
|
||||
angle = 2.0f * saacos(tquat[0]);
|
||||
angle = 2.0f * safe_acosf(tquat[0]);
|
||||
|
||||
quat__axis_angle_sanitize(nullptr, &angle);
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "mathutils.h"
|
||||
|
||||
#include "BLI_math_base_safe.h"
|
||||
#include "BLI_math_matrix.h"
|
||||
#include "BLI_math_rotation.h"
|
||||
#include "BLI_math_vector.h"
|
||||
@@ -1130,7 +1131,7 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return PyFloat_FromDouble(saacos(dot / (sqrt(dot_self) * sqrt(dot_other))));
|
||||
return PyFloat_FromDouble(safe_acosf(dot / (sqrt(dot_self) * sqrt(dot_other))));
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
Reference in New Issue
Block a user