General closed-form inverse kinematics for arbitrary three-joint subproblems based on the product of exponential model