2017-08-01 61 views
0

我試圖按照一些示例代碼https://medium.com/@yatchoi/getting-started-with-arkit-real-life-waypoints-1707e3cb1da2下方,我越來越unresolved identifier 'MatrixHelper'在iOS/Swift中,MatrixHelper是什麼模塊的一部分?

let translationMatrix = MatrixHelper.translate(
     x: 0, 
     y: 0, 
     z: distance * -1 
    ) 
    // Rotation matrix theta degrees 
    let rotationMatrix = MatrixHelper.rotateAboutY(
     degrees: bearing * -1 
    ) 

什麼庫或包我需要導入得到MatrixHelper - 一些數學包?我搜索了文檔,但找不到任何東西。

回答

2

我想他只是寫了一個自定義類來包裝GLKit提供的功能。

他將該類命名爲MatrixHelper。

隨着MatrixHelper.rotateAboutY(),他在呼喚這樣的:

GLKMatrix4 GLKMatrix4Rotate(GLKMatrix4 matrix, float radians, float x, float y, float z); 

所以在MatrixHelper使用的包裝是GLKit和更精確GLKMatrix4

https://developer.apple.com/documentation/glkit/glkmatrix4-pce

+0

我建議反對使用GLKMatrix4或其他GLKMath類型,除非您與其他GLKit API交互 - Apple的新「SIMD」庫('simd_float4x4'和相關類型)提供更好的性能,並且直接受ARKit,SceneKit和其他高級高層框架。 (有些矩陣數學方便的封裝代碼對於SIMD類型的使用會很好) – rickster

+0

您說得對,感謝評論 – Retterdesdialogs

+0

,那麼我們如何使用SIMD實現rotateAboutY? – MonkeyBonkey