A solution to the extended and generalized inverse kinematic problem