SceneKit Transformation ScnMatrix4

时间:2014-08-17 13:01:28

标签: scenekit

ScnMatrix4是一个4x4矩阵。我的问题是矩阵行对应于位置(ScnVector3),旋转(ScnVector4),缩放(ScnVector3)。第四排是空的吗?

编辑:  我玩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;我很擅长编辑:(

2 个答案:

答案 0 :(得分:7)

核心动画编程指南简要解释了这一点:

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

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

答案 1 :(得分:0)

GLKit有一些超级有用的数学函数可供玩这些。

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

本部分文档部分说明了:

  

讨论

     

第3列的前三个组成部分提供了翻译值   tx,ty和tz。

翻译功能可以进行移动。并且比手动操作更容易,更容易。