Skip to content

Instantly share code, notes, and snippets.

@elijahzarlin
Last active September 13, 2018 18:34
Show Gist options
  • Select an option

  • Save elijahzarlin/931c2bf60657d97fddc20333fdc7ca0a to your computer and use it in GitHub Desktop.

Select an option

Save elijahzarlin/931c2bf60657d97fddc20333fdc7ca0a to your computer and use it in GitHub Desktop.
world-scale-ar-2
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