speed optimizations for forward kinematics