ARKit转换中的不同列分别代表什么? [英] What does the different columns in transform in ARKit represent?

查看:134
本文介绍了ARKit转换中的不同列分别代表什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ARAnchor有6列,最后3列表示xyz坐标.

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 like simd_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 4x4 Matrix with 16 useful elements. The Identity 4x4 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允许您围绕XY轴使用魔术三角函数(sincos).

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个翻译元素(txtytz)位于最后一列:

And, of course, 3 elements for translation (tx,ty,tz) in the 4x4 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中的列索引为:0123 .

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆