From 94d26d2b524be271614eec6e1db3b90e974753e3 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Wed, 7 Aug 2024 16:33:17 +0200 Subject: [PATCH] [csharp] Minor: port of commit 877e705, moved common subexpression part out. See commit b17595d. --- spine-csharp/src/IkConstraint.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spine-csharp/src/IkConstraint.cs b/spine-csharp/src/IkConstraint.cs index e8a72c8f9..66c3dcb58 100644 --- a/spine-csharp/src/IkConstraint.cs +++ b/spine-csharp/src/IkConstraint.cs @@ -328,8 +328,9 @@ namespace Spine { q = -(c1 + q) * 0.5f; float r0 = q / c2, r1 = c / q; float r = Math.Abs(r0) < Math.Abs(r1) ? r0 : r1; - if (dd - r * r >= 0) { - y = (float)Math.Sqrt(dd - r * r) * bendDir; + r0 = dd - r * r; + if (r0 >= 0) { + y = (float)Math.Sqrt(r0) * bendDir; a1 = ta - (float)Math.Atan2(y, r); a2 = (float)Math.Atan2(y / psy, (r - l1) / psx); goto break_outer; // break outer;