Convert SceneKit ScnMatrix4

ScnMatrix4 is a 4x4 matrix. My question is which rows of the matrix correspond to position (ScnVector3), rotation (ScnVector4), scale (ScnVector3). Is the 4th row empty?

Edit: I was playing with an SCN4 matrix, I needed to create a form with several stairs.

I need matrix information for the Shapeswithshapes method

[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; XYZ = 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; 

Change 2; I suck while editing :(

+6
source share
2 answers

The Core Animation Programming Guide briefly explains this:

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

In the case of complex transformations, it is not always possible to extract position / rotation / scaling information directly from the coefficients.

+7
source

GLKit has several useful math functions for playing with them.

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

Part of these doc sections talks about things like:

Discussion

The first three components of column 3 provide the shift values ​​tx, ty, and tz.

Translate functions do the movement. And do it much, much, much easier than doing things by hand.

0
source

Source: https://habr.com/ru/post/973930/


All Articles