场景套件变换值,它们是如何实现的?



Apple的SceneKit文档建议对象的变换矩阵由旋转,位置和缩放信息组成。但是,转换矩阵是 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

我很确定这是CATransform3D:

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

这是苹果臭名昭著的文档历史上一些最糟糕的"文档"。

试试这个,从回溯机器,当他们过去至少更深入地谈论事情时......有点: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是整个矩阵中最有趣的,因为它通常被称为负责透视。

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

最新更新