ARKit and CoreLocation: Part One

Navigation With Linear Algebra (and Trig)

Christopher Webb
Aug 26, 2017 · 10 min read
Image for post
Image for post
Personal project — August 17th
Demo CodeARKit and CoreLocation: Part OneARKit and CoreLocation: Part TwoARKit and CoreLocation: Part Three

Background

Introduction

Image for post
Image for post

Augmented reality (AR) describes user experiences that add 2D or 3D elements to the live view from a device’s camera in a way that makes those elements appear to inhabit the real world. ARKit combines device motion tracking, camera scene capture, advanced scene processing, and display conveniences to simplify the task of building an AR experience.

First, Some Fundamentals

Image for post
Image for post
Personal Project — August 20th

Definitions

Image for post
Image for post
worldAlignment: The worldAlignment property on ARSession defines how the ARSession interprets the ARFrame’s motion data on a 3D coordinate mapping system that is uses to keep track of the world and build the Augmented Reality experience.
Image for post
Image for post
Source
gravity: By setting the alignment to gravity ARKit aligns the y-axis parallel to gravity and the z and x axes are oriented along the original heading of the device.
Image for post
Image for post
Source
gravityAndHeading: By setting the alignment to gravityAndHeading ARKit aligns the y-axis parallel to gravity and the z and x axes orient towards compass heading. The origin is placed at the initial location of the device. While this is accurate most of the time, it’s precision is not incredibly high so creating an immersive augmented reality experience while solely relying on this data can be tricky.
Image for post
Image for post
Source

SceneKit

Image for post
Image for post
Personal project — August 11th

Definition

Image for post
Image for post
Personal project — August 12th

Adding Node To Scene

Image for post
Image for post
Source

Definitions

SphereNode Sphere Code

sceneView.scene = SCNScene()        
// Add Scene
let circleNode = createSphereNode(with: 0.2, color: .blue)
// Add Sphere

circleNode.position = SCNVector3(0, 0, -1) // 1 meter in front
// Give sphere position

sceneView.scene.rootNode.addChildNode(circleNode)
// Add to scene as childNode of rootNode
Image for post
Image for post

Vectors and Matrice and Linear Algebra, Oh No!

Image for post
Image for post
A two by four matrix.

In mathematics, physics, and engineering, a Euclidean vector (sometimes called a geometric or spatial vector, or — as here — simply a vector) is a geometric object that has magnitude (or length) and direction.

Wikipedia

Image for post
Image for post
Image for post
Image for post
X over Y

Transformations

Transformed Point = Transformation Matrix × Original Point
Image for post
Image for post
source

Rotating A Space Ship

Image for post
Image for post

Loop-T-Loops

Image for post
Image for post
Image for post
Image for post

Navigation

Definitions

print(route.name)// Broadwayprint(route.advisoryNotices)// []print(route.expectedTravelTime)// 2500.0
print(step.distance)// 1.0print(step.instructions)// Proceed to 7th Ave
Image for post
Image for post
Personal project — August 13th

Sources:

Journey Of One Thousand Apps

The journey of one thousand apps starts with a single key…

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store