Xcode simd - issue with Translation and Rotation Matrix Example

十年热恋 提交于 2019-11-29 08:58:46

This can be confusing, yes.

The documentation you mentions makes the following computation:

let translatedVector = positionVector * translationMatrix

Note that the matrix is on the right side of the multiplication. You are probably used to the notation b = M * a but if you take the transpose you get b' = a' * M' which is what the sample does.

In SIMD there's no way to differentiate a vector from its transpose (b from b') and the library allows you to make the multiplication in both ways:

static simd_float3 SIMD_CFUNC simd_mul(simd_float3x3 __x, simd_float3 __y);
static simd_float3 SIMD_CFUNC simd_mul(simd_float3 __x,  simd_float3x3 __y) { return simd_mul(simd_transpose(__y), __x); }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!