ARKit转换中的不同列分别代表什么? [英] What does the different columns in transform in ARKit represent?
问题描述
ARAnchor
有6列,最后3列表示x
,y
和z
坐标.
An ARAnchor
has 6 columns of which the last 3 represent the x
, y
, and z
coordinates.
我想知道其他(前三列)代表什么?
I was wondering what the other (first) 3 columns represent?
推荐答案
ARKit,RealityKit和SceneKit框架使用
4 x 4
Transformation Matrices
来平移,旋转,缩放和剪切3D对象(就像simd_float4x4
矩阵类型一样).让我们看看这些矩阵的样子.
ARKit, RealityKit and SceneKit frameworks use
4 x 4
Transformation Matrices
to translate, rotate, scale and shear 3D objects (just likesimd_float4x4
matrix type). Let's see how these matrices look like.
在3D图形中,我们经常使用具有16个有用元素的4
x 4
矩阵.身份4
x 4
矩阵如下:
In 3D Graphics we often use a 4
x4
Matrix with 16 useful elements. The Identity 4
x4
Matrix is as following:
在这16个元素之间,有6个不同的剪切系数:
Between those sixteen elements there are 6 different shearing coefficients:
shear XY
shear XZ
shear YX
shear YZ
shear ZX
shear ZY
在Shear Matrix中,它们如下:
In Shear Matrix they are as followings:
因为此矩阵中根本没有 ,所以六个Shear coefficients
和三个Scale coefficients
允许您围绕X
,Y
和sin
和cos
).
Because there are no Rotation coefficients
at all in this Matrix, six Shear coefficients
along with three Scale coefficients
allow you rotate 3D objects about X
, Y
, and Z
axis using magical trigonometry (sin
and cos
).
这是一个使用Shear和Scale元素如何围绕其Z
轴旋转3D对象(CCW)的示例:
Here's an example how to rotate 3D object (CCW) about its Z
axis using Shear and Scale elements:
使用剪切"和缩放"元素查看3种不同的旋转模式:
Look at 3 different Rotation patterns using Shear and Scale elements:
当然,4
x 4
Matrix
中的3个翻译元素(tx
,ty
,tz
)位于最后一列:
And, of course, 3 elements for translation (tx
,ty
,tz
) in the 4
x4
Matrix
are located on the last column:
┌ ┐
| 1 0 0 tx |
| 0 1 0 ty |
| 0 0 1 tz |
| 0 0 0 1 |
└ ┘
ARKit,SceneKit和RealityKit中的列索引为:
0
,1
,2
,3
.
The columns' indices in ARKit, SceneKit and RealityKit are:
0
,1
,2
,3
.
第四列(索引3)用于转换值:
The fourth column (index 3) is for translation values:
var translation = matrix_identity_float4x4
translation.columns.3.x
translation.columns.3.y
translation.columns.3.z
这篇关于ARKit转换中的不同列分别代表什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!