mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +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;
|
||||
}
|
||||
}
|
||||
float minAngle = 0, minDist = Float.MAX_VALUE, minX = 0, minY = 0;
|
||||
float maxAngle = 0, maxDist = 0, maxX = 0, 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 minAngle = PI, minX = l1 - a, minDist = minX * minX, minY = 0;
|
||||
float maxAngle = 0, maxX = l1 + a, maxDist = maxX * maxX, maxY = 0;
|
||||
float angle = (float)Math.acos(-a * l1 / (aa - bb));
|
||||
x = a * cos(angle) + l1;
|
||||
y = b * sin(angle);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user