SCNNode 的 convertTransform - 幕后

SCNNode's convertTransform - Behind the scenes

我正在尝试将 SCNNode 的 convertTransform 转换为 Eigen,但我显然不了解幕后发生的事情。

let targetNodeTransform = targetNode?.convertTransform(transform, from: nil)

我正在使用 Eigen,所以我认为变换的逆是相同的。情况似乎并非如此,那么当从世界坐标 space 到对象坐标 space 时,convertTransform 中发生了什么?我正在寻找 convertTransform 背后的数学原理,以便我可以使用 Eigen 来实现它。

确定这等同于上面convertTransform返回的值。

let targetNodeTransform = SCNMatrix4Mult(transform, SCNMatrix4Invert((targetNode?.worldTransform)!));

根据 SCNNode 的 worldTransform 文档

A world transform is the node’s coordinate space transformation relative to the scene’s coordinate space. This transformation is the concatenation of the node’s transform property with that of its parent node, the parent’s parent, and so on up to the rootNode object of the scene.