SceneKit变换值,它们是如何实现的?

时间:2018-05-02 10:40:04

标签: ios swift scenekit arkit

Apple's SceneKit documentation表明对象的变换矩阵由旋转,位置和比例信息组成。然而,变换矩阵是4x4矩阵,最后一列是0,0,0,1。这些值究竟是什么,是否有更详细的解释?像哪些列/行代表什么,为什么有4行,最后一列是什么?

示例代码:

for t in 0...3 {
    print("\t")
    for n in frame.camera.transform[t] {
        print(String(format: "%10.1f", n),terminator: "");
    }
}

输出:

   0.1      -0.7       0.7       0.0    
   1.0       0.2      -0.1       0.0    
  -0.1       0.7       0.7       0.0    
   0.3      -0.1       0.0       1.0

1 个答案:

答案 0 :(得分:3)

我很确定这是CATransform3D:

https://developer.apple.com/documentation/quartzcore/catransform3d

这是苹果公司臭名昭着的asinine文档历史上最愚蠢的“文档”。

尝试使用这种方式,当他们过去至少更深入地谈论事情时......有点:https://web.archive.org/web/20111010140734/http://developer.apple.com/library/mac/#/web/20111012014313/https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/Layers.html

m34是整个矩阵中最有趣的,因为它通常被称为负责perspective

这是有史以来关于核心动画的最佳文章之一,它解释了这种转变的一些方面:http://www.thinkandbuild.it/introduction-to-3d-drawing-in-core-animation-part-1/

相关问题