# I can rotate a matrix around three vectors to get a new transform. How would you do the reverse?

I have the inverse kinematic solution for my 6dof robot arm: from the orientation matrix and the position of the finger tip I can use the dimensions of the arm to calculate the angles of every joint and translate that into motor steps for motion.

When I’m driving the arm with inverse kinematics I translate the finger with XYZ steps and I rotate the finger tip with UVW, like in this java code:

``// On a 3-axis robot when homed the forward axis of the finger tip is pointing downward. // More complex arms start from the same assumption. Vector3f forward = new Vector3f(0,0,1); Vector3f right = new Vector3f(1,0,0); Vector3f up = new Vector3f(); up.cross(forward,right); Vector3f of = new Vector3f(forward); Vector3f or = new Vector3f(right); Vector3f ou = new Vector3f(up); Vector3f result; result = MathHelper.rotateAroundAxis(forward,of,Math.toRadians(ikU)); result = MathHelper.rotateAroundAxis(result ,or,Math.toRadians(ikV)); result = MathHelper.rotateAroundAxis(result ,ou,Math.toRadians(ikW)); fingerForward.set(result); result = MathHelper.rotateAroundAxis(right ,of,Math.toRadians(ikU)); result = MathHelper.rotateAroundAxis(result,or,Math.toRadians(ikV)); result = MathHelper.rotateAroundAxis(result,ou,Math.toRadians(ikW)); fingerRight.set(result); ``

I have MOST of the forward kinematics. Given the angles at every joint I can calculate the position and the matrix at the finger tip. What I am missing is how to turn that orientation matrix back in to ikU, ikV, ikW values.

So, math experts of reddit… please teach me the terrible secret of space, and how to reverse this transformation.

submitted by /u/i-make-robots