diff options
author | Hallam Roberts <MysteryPancake> | 2022-03-11 18:14:05 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-03-11 20:27:58 +0300 |
commit | 3da84d8b086bd2d09beb5bdb89ba6beddf1e1dd6 (patch) | |
tree | 698e6793ba776716a256abf10ed4b1623ade15eb /source/blender/editors/uvedit | |
parent | 62a0984d7290cbd6fd3acfa79d53765f97f93b0a (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/editors/uvedit')
-rw-r--r-- | source/blender/editors/uvedit/uvedit_parametrizer.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index f19b32e3ad4..3f7c7745bff 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -2059,7 +2059,7 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair) a1 = a1 - M_PI / 3.0; a2 = a2 - M_PI / 3.0; a3 = a3 - M_PI / 3.0; - shapeold = (a1 * a1 + a2 * a2 + a3 * a3) / ((M_PI / 2) * (M_PI / 2)); + shapeold = (a1 * a1 + a2 * a2 + a3 * a3) / (M_PI_2 * M_PI_2); nshapeold++; } @@ -2068,7 +2068,7 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair) a1 = a1 - M_PI / 3.0; a2 = a2 - M_PI / 3.0; a3 = a3 - M_PI / 3.0; - shapenew = (a1 * a1 + a2 * a2 + a3 * a3) / ((M_PI / 2) * (M_PI / 2)); + shapenew = (a1 * a1 + a2 * a2 + a3 * a3) / (M_PI_2 * M_PI_2); nshapenew++; } @@ -3730,7 +3730,7 @@ static float p_chart_minimum_area_angle(PChart *chart) minarea = 1e10; minangle = 0.0; - while (rotated <= (float)(M_PI / 2.0)) { /* INVESTIGATE: how far to rotate? */ + while (rotated <= (float)M_PI_2) { /* INVESTIGATE: how far to rotate? */ /* rotate with the smallest angle */ i_min = 0; mina = 1e10; @@ -3777,8 +3777,8 @@ static float p_chart_minimum_area_angle(PChart *chart) } /* try keeping rotation as small as possible */ - if (minangle > (float)(M_PI / 4)) { - minangle -= (float)(M_PI / 2.0); + if (minangle > (float)M_PI_4) { + minangle -= (float)M_PI_2; } MEM_freeN(angles); |