diff --git a/spine-c/spine-c/src/spine/IkConstraint.c b/spine-c/spine-c/src/spine/IkConstraint.c index 337f8e96a..a296f8dad 100644 --- a/spine-c/spine-c/src/spine/IkConstraint.c +++ b/spine-c/spine-c/src/spine/IkConstraint.c @@ -94,13 +94,13 @@ void spIkConstraint_apply1(spBone *bone, float targetX, float targetY, int /*boo default: { float x = targetX - p->worldX, y = targetY - p->worldY; float d = pa * pd - pb * pc; - if (ABS(d) <= 0.0001f) { - tx = 0; - ty = 0; - } else { - tx = (x * pd - y * pb) / d - bone->ax; - ty = (y * pa - x * pc) / d - bone->ay; - } + if (ABS(d) <= 0.0001f) { + tx = 0; + ty = 0; + } else { + tx = (x * pd - y * pb) / d - bone->ax; + ty = (y * pa - x * pc) / d - bone->ay; + } } } rotationIK += ATAN2(ty, tx) * RAD_DEG; @@ -183,7 +183,7 @@ void spIkConstraint_apply2(spBone *parent, spBone *child, float targetX, float t c = pp->c; d = pp->d; id = a * d - b * c; - id = ABS(id) <= 0.0001f ? 0 : 1 / id; + id = ABS(id) <= 0.0001f ? 0 : 1 / id; x = cwx - pp->worldX; y = cwy - pp->worldY; dx = (x * d - y * b) * id - px; diff --git a/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp b/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp index 1d3a0dd8e..19b602428 100644 --- a/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp +++ b/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp @@ -61,13 +61,13 @@ void IkConstraint::apply(Bone &bone, float targetX, float targetY, bool compress default: float x = targetX - p->_worldX, y = targetY - p->_worldY; float d = pa * pd - pb * pc; - if (MathUtil::abs(d) <= 0.0001f) { - tx = 0; - ty = 0; - } else { - tx = (x * pd - y * pb) / d - bone._ax; - ty = (y * pa - x * pc) / d - bone._ay; - } + if (MathUtil::abs(d) <= 0.0001f) { + tx = 0; + ty = 0; + } else { + tx = (x * pd - y * pb) / d - bone._ax; + ty = (y * pa - x * pc) / d - bone._ay; + } } rotationIK += MathUtil::atan2(ty, tx) * MathUtil::Rad_Deg; if (bone._ascaleX < 0) rotationIK += 180; @@ -146,8 +146,8 @@ void IkConstraint::apply(Bone &parent, Bone &child, float targetX, float targetY c = pp->_c; d = pp->_d; id = a * d - b * c; - id = MathUtil::abs(id) <= 0.0001f ? 0 : 1 / id; - x = cwx - pp->_worldX; + id = MathUtil::abs(id) <= 0.0001f ? 0 : 1 / id; + x = cwx - pp->_worldX; y = cwy - pp->_worldY; dx = (x * d - y * b) * id - px; dy = (y * a - x * c) * id - py;