Mannequin bones rotations from external 3D positionnal data

I am trying to use joints positional data from a 3D skeleton mesh that I got from another 3D editor to apply an FRotator to each bone of a UE5 mannequin.

My challenge is to match the poses.

For instance, this is what I am trying to resolve: I have 3D location data for the left shoulder, elbow and wrist for that skeleton. I am trying to determine the FRotator (or FQuat) to apply to the lower arm bone that is comprised between these 3 joints but I am not getting accurate results. Not sure if it’s the Pitch, Roll or Yaw.

I want to apply only rotations on bones, not locations, since I do not want to deform the UE5 mannequin.

Ideally, I would like to find a solution in C++, but blueprint is Ok (I can translate to C++).

Any pointers are welcome.

Thanks.