FITC Preview, Improved 2-link IK

Continuing the preview of my FITC Toronto presentation, I alluded yesterday to a hybrid algebraic/geometric algorithm for solving the in-plane, 2-link IK problem. Other solutions presented in the Flash community tend to use bones of equal length, hiding issues with infeasible solutions. The previous post illustrated one such problem from the code in the book, ‘Making Things Move.’ The following screen shot illustrates the hybrid solver with two bones of different length and a minimal-error orientation for an infeasible solution.

An additional feature of the algorithm is that it produces a solution with less computation. A typical geometric solution (i.e. MTM) involves two inverse cosines and an inverse tangent along with some supplemental computations and sin, cos operations to position the second bone. The hybrid approach requires a single inverse cosine and inverse tangent.

The computational savings are not overwhelming, but in a game engine, every cycle saved in IK is a cycle available for rendering, AI, etc. A typical bipedal character has two arms and two legs, so animating that character in a game engine generally involves solutions across multiple chains. Those savings add up 🙂

Another feature is that the second bone’s orientation relative to the parent is directly computed, making it easy to test for joint limits. In a production rig, an IK solver that does not take joint limits into account is practically worthless.

See you in Toronto.