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:
authorHallam Roberts <MysteryPancake>2022-03-11 18:14:05 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-03-11 20:27:58 +0300
commit3da84d8b086bd2d09beb5bdb89ba6beddf1e1dd6 (patch)
tree698e6793ba776716a256abf10ed4b1623ade15eb /source/blender/blenkernel/intern
parent62a0984d7290cbd6fd3acfa79d53765f97f93b0a (diff)
Cleanup: use M_PI_2 and M_PI_4 where possible
The constant M_PI_4 is added to GLSL to ensure it works there too. Differential Revision: https://developer.blender.org/D14288
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/armature_test.cc2
-rw-r--r--source/blender/blenkernel/intern/mask.c4
-rw-r--r--source/blender/blenkernel/intern/particle_child.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/armature_test.cc b/source/blender/blenkernel/intern/armature_test.cc
index 7475e6f36d4..4d266c8493a 100644
--- a/source/blender/blenkernel/intern/armature_test.cc
+++ b/source/blender/blenkernel/intern/armature_test.cc
@@ -285,7 +285,7 @@ TEST(vec_roll_to_mat3_normalized, Roll1)
const float expected_roll_mat[3][3] = {{0.211324856f, 0.577350259f, -0.788675129f},
{0.577350259f, 0.577350259f, 0.577350259f},
{0.788675129f, -0.577350259f, -0.211324856f}};
- test_vec_roll_to_mat3_normalized(input, float(M_PI * 0.5), expected_roll_mat);
+ test_vec_roll_to_mat3_normalized(input, float(M_PI_2), expected_roll_mat);
}
/** Test that the matrix is orthogonal for an input close to -Y. */
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index da0f899001c..42e65a95404 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -609,7 +609,7 @@ float BKE_mask_spline_project_co(MaskSpline *spline,
if (len_squared_v2(v1) > proj_eps_sq) {
ang1 = angle_v2v2(v1, n1);
- if (ang1 > (float)M_PI / 2.0f) {
+ if (ang1 > (float)M_PI_2) {
ang1 = (float)M_PI - ang1;
}
@@ -635,7 +635,7 @@ float BKE_mask_spline_project_co(MaskSpline *spline,
if (len_squared_v2(v2) > proj_eps_sq) {
ang2 = angle_v2v2(v2, n2);
- if (ang2 > (float)M_PI / 2.0f) {
+ if (ang2 > (float)M_PI_2) {
ang2 = (float)M_PI - ang2;
}
diff --git a/source/blender/blenkernel/intern/particle_child.c b/source/blender/blenkernel/intern/particle_child.c
index 7a2e4eb4ac9..8106ae8b302 100644
--- a/source/blender/blenkernel/intern/particle_child.c
+++ b/source/blender/blenkernel/intern/particle_child.c
@@ -85,7 +85,7 @@ static void do_kink_spiral_deform(ParticleKey *state,
* and goes up to the Golden Spiral for 1.0
* https://en.wikipedia.org/wiki/Golden_spiral
*/
- const float b = shape * (1.0f + sqrtf(5.0f)) / (float)M_PI * 0.25f;
+ const float b = shape * (1.0f + sqrtf(5.0f)) / (float)M_PI_4;
/* angle of the spiral against the curve (rotated opposite to make a smooth transition) */
const float start_angle = ((b != 0.0f) ? atanf(1.0f / b) : (float)-M_PI_2) +
(b > 0.0f ? -(float)M_PI_2 : (float)M_PI_2);