【问题标题】:SceneKit Transformation ScnMatrix4SceneKit 转换 ScnMatrix4
【发布时间】:2014-10-10 13:06:13
【问题描述】:

ScnMatrix4 是一个 4x4 矩阵。我的问题是什么矩阵行对应位置(ScnVector3),旋转(ScnVector4),比例(ScnVector3)。第 4 行是空的吗?

编辑: 我玩过 SCN4matrix,我需要它来创建具有多个楼梯的形状。

我需要 Shapeswithshapes 方法的矩阵信息

  [SCNphysicsShape shapeWithShapes: (ElementArray*) :(transformArray)];

 ScnMatrix4=  | Xx  Xy Xy X|
              | Yx  Yy Yz Y|
              | Zx  Zy Zz Z|
              | Px  Py Pz W|

  Xx  Xy Xy = The X axis vector of the local coordinate system of the shape.
  Yx  Yy Yz = The y axis vector of the local coordinate system of the shape.
  Zx  Zy Zz = The z axis vector of the local coordinate system of the shape.

  Px = position in x axis relative to parent;
  Py = Position in y axis relative to parent;
  Pz = Position in z Axis relative to parent;
  X Y Z = read the link for info;
  W= 1 define that the matrix is about the position relative to parent;
  W= 0 define that the matrix is about orientation;

 Basicly a SCNmatriX4 completely describes the position, rotation of a node/shape.


  http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/
  This Link Provides a great source for all the info you need about Matrix Manipulation;

编辑 2;我不擅长编辑:(

【问题讨论】:

  • 变换矩阵不是这样工作的。它的构造使得一个矩阵向量乘法可以应用整个变换。

标签: scenekit


【解决方案1】:

Core Animation 编程指南简要解释了这一点:

https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/CoreAnimation_guide/CoreAnimationBasics/CoreAnimationBasics.html#//apple_ref/doc/uid/TP40004514-CH2-SW18

在复杂变换的情况下,并不总是可以直接从系数中提取位置/旋转/比例信息。

【讨论】:

    【解决方案2】:

    GLKit 有一些非常有用的数学函数可以用来玩这些。

    https://developer.apple.com/library/prerelease/ios/documentation/GLkit/Reference/GLKMatrix4/index.html

    本文档部分的部分内容如下:

    讨论

    第 3 列的前三个组件提供翻译值 tx、ty 和 tz。

    翻译功能进行移动。并且比手动操作要容易得多。

    【讨论】:

    • Scene Kit 使用行排序,而不是 OpenGL 中的列排序。在 sceneKit 中,最后一行的前 3 个组件为我们提供了翻译。
    猜你喜欢
    • 2017-12-07
    • 2019-02-17
    • 1970-01-01
    • 2018-01-31
    • 2015-07-13
    • 2015-02-20
    • 2017-07-26
    • 2017-10-29
    • 2016-07-29
    相关资源
    最近更新 更多