mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
IK simplification.
Just when you thought it couldn't get any simpler.
This commit is contained in:
parent
277f96d50f
commit
1de5adf953
@ -231,22 +231,8 @@ public class IkConstraint implements Constraint {
|
|||||||
break outer;
|
break outer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float minAngle = 0, minDist = Float.MAX_VALUE, minX = 0, minY = 0;
|
float minAngle = PI, minX = l1 - a, minDist = minX * minX, minY = 0;
|
||||||
float maxAngle = 0, maxDist = 0, maxX = 0, maxY = 0;
|
float maxAngle = 0, maxX = l1 + a, maxDist = maxX * maxX, maxY = 0;
|
||||||
x = l1 + a;
|
|
||||||
d = x * x;
|
|
||||||
if (d > maxDist) {
|
|
||||||
maxAngle = 0;
|
|
||||||
maxDist = d;
|
|
||||||
maxX = x;
|
|
||||||
}
|
|
||||||
x = l1 - a;
|
|
||||||
d = x * x;
|
|
||||||
if (d < minDist) {
|
|
||||||
minAngle = PI;
|
|
||||||
minDist = d;
|
|
||||||
minX = x;
|
|
||||||
}
|
|
||||||
float angle = (float)Math.acos(-a * l1 / (aa - bb));
|
float angle = (float)Math.acos(-a * l1 / (aa - bb));
|
||||||
x = a * cos(angle) + l1;
|
x = a * cos(angle) + l1;
|
||||||
y = b * sin(angle);
|
y = b * sin(angle);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user