How to use Arkit camera rotation (eularAngles) in PCL (Converting to Eigen Affine3f)

  arkit, c++, swift

I am not familiar with rotation, matrix, and math stuff.
I am trying to texture the exported 3D mesh data(obj) generated by Arkit from the new iPad Pro (the one with lidar).

I am saving all data on disk (image and textfiles) and send them to Linux PC and texturing them with C++ library (PCL) on Linux pc.

here is the source code I am using.
As you can see from line number 364 to 386 is where camera position and rotation are set.
I set the pose(0,3), pose(1,3), pose(2,3) with data from transform.position.x to z It seems to be working fine! But the problem is the rotation matrix which is cam.pose(0,0) to cam.pose(2,2). I tried using[0] to[2] from Arkit(in swift language) in same position. No luck!

So, I tried to use xyz and convert them to rotation matrix! and also no luck. here is my code

  GotoLine(myReadFile, 2); // this is xyz position
  myReadFile >> val; cam.pose (0,3)=val; //TX
  myReadFile >> val; cam.pose (1,3)=val; //TY
  myReadFile >> val; cam.pose (2,3)=val; //TZ

  GotoLine(myReadFile,16); // reading x y z from txt file.
  double angelX,angelY,angelZ;
  myReadFile >> angelX;
  myReadFile >> angelY;
  myReadFile >> angelZ;

  using namespace Eigen;{
        Matrix3f m;
        m = AngleAxisf(angelX * M_PI , Vector3f::UnitX()) 
           *AngleAxisf(angelY * M_PI , Vector3f::UnitY()) 
           *AngleAxisf(angelZ * M_PI, Vector3f::UnitZ());

        //I also tried using angel * (180/M_PI) for all XYZ

        cam.pose(0,0) = m(0,0); //There might be better way to do this 
        cam.pose(0,1) = m(0,1);
        cam.pose(0,2) = m(0,2);

        cam.pose(1,0) = m(1,0);
        cam.pose(1,1) = m(1,1);
        cam.pose(1,2) = m(1,2);

        cam.pose(2,0) = m(2,0);
        cam.pose(2,1) = m(2,1);
        cam.pose(2,2) = m(2,2);

  cam.pose (3,0) = 0.0;
  cam.pose (3,1) = 0.0;
  cam.pose (3,2) = 0.0;
  cam.pose (3,3) = 1.0;

I am pulling my hair off on this one.
if anyone can help me, It will really save my day. If there is an alternative library in any language, please please please, tell me.
Thank you in advance!

Source: Windows Questions C++