diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-04-30 16:41:05 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-04-30 16:41:05 +0300 |
commit | c96506d54ad0aeb683896db50cf787d90840f702 (patch) | |
tree | 98bc13bbaf321b76d4853b5f08ce7aa57148b833 | |
parent | 8f27ea40d637d1b9545ad2a911cdb100230666e2 (diff) | |
parent | a58a8296d9da785920575725bbb41fd5481b5d2d (diff) |
Merge branch 'blender-v2.93-release'
-rw-r--r-- | source/blender/modifiers/intern/MOD_simpledeform.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index 6300db2cb36..db01dec4d19 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -184,10 +184,12 @@ static void simpleDeform_bend(const float factor, sint = sinf(theta); cost = cosf(theta); + /* NOTE: the operations below a susceptible to float precision errors + * regarding the order of operations, take care when changing, see: T85470 */ switch (axis) { case 0: r_co[0] = x; - r_co[1] = (y - 1.0f / factor) * cost + 1.0f / factor; + r_co[1] = y * cost + (1.0f - cost) / factor; r_co[2] = -(y - 1.0f / factor) * sint; { r_co[0] += dcut[0]; @@ -196,7 +198,7 @@ static void simpleDeform_bend(const float factor, } break; case 1: - r_co[0] = (x - 1.0f / factor) * cost + 1.0f / factor; + r_co[0] = x * cost + (1.0f - cost) / factor; r_co[1] = y; r_co[2] = -(x - 1.0f / factor) * sint; { @@ -207,7 +209,7 @@ static void simpleDeform_bend(const float factor, break; default: r_co[0] = -(y - 1.0f / factor) * sint; - r_co[1] = (y - 1.0f / factor) * cost + 1.0f / factor; + r_co[1] = y * cost + (1.0f - cost) / factor; r_co[2] = z; { r_co[0] += cost * dcut[0]; |