SCNMatrix4的前两列是什么?

我正在阅读这个结构的文档,但似乎没有足够的信息,m3是矩阵的第3列,m4第4列包含有关3D空间中节点的方向和位置的信息相应我知道因为某些课程在Udemy。

现在,提取方向和其他东西的唯一方法是:

guard let pointOfView = sceneView.pointOfView else { return } let transform = pointOfView.transform let orientaiton = SCNVector3(-transform.m31, -transform.m32, -transform.m33) 

我认为与SceneKit相比,ARKit的API不同

Apple文档链接: https : //developer.apple.com/documentation/scenekit/scnmatrix4/1621081-m11

SCNMatrix4是3d 变换矩阵 。 简而言之:

 M = T * R * S 

翻译(tx,ty,tz):

  ┌ ┐ T = | 1 0 0 tx | | 0 1 0 ty | | 0 0 1 tz | | 0 0 0 1 | └ ┘ 

按(sx,sy,sz)缩放:

  ┌ ┐ S = | sx 0 0 0 | | 0 sy 0 0 | | 0 0 sz 0 | | 0 0 0 1 | └ ┘ 

旋转(rx,ry,rz):

 R = ZYX ┌ ┐ X = | 1 0 0 0 | | 0 cos(rx) -sin(rx) 0 | | 0 sin(rx) cos(rx) 0 | | 0 0 0 1 | └ ┘ ┌ ┐ Y = | cos(ry) 0 sin(ry) 0 | | 0 1 0 0 | | -sin(ry) 0 cos(ry) 0 | | 0 0 0 1 | └ ┘ ┌ ┐ Z = | cos(rz) -sin(rz) 0 0 | | sin(rz) cos(rz) 0 0 | | 0 0 1 0 | | 0 0 0 1 | └ ┘ 

顺便说一句,使用SceneKit框架分解SCNMatrix4很简单:

 let n = SCNNode() n.transform = YOUR_MATRIX let position = n.position let orientation = n.orientation let scale = n.scale