Last active
September 13, 2018 18:34
-
-
Save elijahzarlin/931c2bf60657d97fddc20333fdc7ca0a to your computer and use it in GitHub Desktop.
world-scale-ar-2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func transformMatrix(originLocation: CLLocation, destinationLocation: CLLocation) -> simd_float4x4 { | |
| let azimuth = azimuthBetween(origin: originLocation, destination: destinationLocation) | |
| // Place POIs "z" meters away from camera | |
| let position = vector_float4(0, 0, -10, 0) | |
| let translationMatrix = matrix_identity_float4x4.translationMatrix(position) | |
| // Rotate POI based on azimuth | |
| let rotationMatrix = matrix_identity_float4x4.rotationAroundY(radians: azimuth) | |
| // Combine rotation and translation to get final position of POI | |
| let transformMatrix = simd_mul(rotationMatrix, translationMatrix) | |
| return simd_mul(matrix_identity_float4x4, transformMatrix) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment