The original coordinate system is the world coordinate system, and the new coordinate system takes the center of two balls as the Y axis. I use Python to do linear transform for a coordinate system shape model, and it works well. The Y-axis of the transformed model passes through two ball centers, as shown in the first figure. However, I filled the matrix into the transform module and did not get the expected result after applying the transform, just like the second figure.

Let us know if you still need help with this. Provide an example scene and transformation matrix.