master b35ccaa68862 cached
17 files
43.9 KB
13.1k tokens
1 requests
Download .txt
Repository: andrewzimmer906/HeatMapEyeTracking
Branch: master
Commit: b35ccaa68862
Files: 17
Total size: 43.9 KB

Directory structure:
gitextract_ft8wb4sx/

├── HeatMap/
│   ├── AppDelegate.swift
│   ├── Assets.xcassets/
│   │   ├── AppIcon.appiconset/
│   │   │   └── Contents.json
│   │   └── Contents.json
│   ├── Base.lproj/
│   │   ├── LaunchScreen.storyboard
│   │   └── Main.storyboard
│   ├── EyeLasers.swift
│   ├── HeatMap.metal
│   ├── Info.plist
│   ├── RaycastData.swift
│   └── ViewController.swift
├── HeatMap.xcodeproj/
│   ├── project.pbxproj
│   ├── project.xcworkspace/
│   │   ├── contents.xcworkspacedata
│   │   ├── xcshareddata/
│   │   │   └── IDEWorkspaceChecks.plist
│   │   └── xcuserdata/
│   │       └── andrewzimmer.xcuserdatad/
│   │           └── UserInterfaceState.xcuserstate
│   └── xcuserdata/
│       └── andrewzimmer.xcuserdatad/
│           ├── xcdebugger/
│           │   └── Breakpoints_v2.xcbkptlist
│           └── xcschemes/
│               └── xcschememanagement.plist
└── README.md

================================================
FILE CONTENTS
================================================

================================================
FILE: HeatMap/AppDelegate.swift
================================================
//
//  AppDelegate.swift
//  HeatMap
//
//  Created by Andrew Zimmer on 6/11/18.
//  Copyright © 2018 AndrewZimmer. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        return true
    }

    func applicationWillResignActive(_ application: UIApplication) {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
    }

    func applicationDidEnterBackground(_ application: UIApplication) {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }

    func applicationWillEnterForeground(_ application: UIApplication) {
        // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
    }

    func applicationDidBecomeActive(_ application: UIApplication) {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }

    func applicationWillTerminate(_ application: UIApplication) {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    }


}



================================================
FILE: HeatMap/Assets.xcassets/AppIcon.appiconset/Contents.json
================================================
{
  "images" : [
    {
      "idiom" : "iphone",
      "size" : "20x20",
      "scale" : "2x"
    },
    {
      "idiom" : "iphone",
      "size" : "20x20",
      "scale" : "3x"
    },
    {
      "idiom" : "iphone",
      "size" : "29x29",
      "scale" : "2x"
    },
    {
      "idiom" : "iphone",
      "size" : "29x29",
      "scale" : "3x"
    },
    {
      "idiom" : "iphone",
      "size" : "40x40",
      "scale" : "2x"
    },
    {
      "idiom" : "iphone",
      "size" : "40x40",
      "scale" : "3x"
    },
    {
      "idiom" : "iphone",
      "size" : "60x60",
      "scale" : "2x"
    },
    {
      "idiom" : "iphone",
      "size" : "60x60",
      "scale" : "3x"
    },
    {
      "idiom" : "ipad",
      "size" : "20x20",
      "scale" : "1x"
    },
    {
      "idiom" : "ipad",
      "size" : "20x20",
      "scale" : "2x"
    },
    {
      "idiom" : "ipad",
      "size" : "29x29",
      "scale" : "1x"
    },
    {
      "idiom" : "ipad",
      "size" : "29x29",
      "scale" : "2x"
    },
    {
      "idiom" : "ipad",
      "size" : "40x40",
      "scale" : "1x"
    },
    {
      "idiom" : "ipad",
      "size" : "40x40",
      "scale" : "2x"
    },
    {
      "idiom" : "ipad",
      "size" : "76x76",
      "scale" : "1x"
    },
    {
      "idiom" : "ipad",
      "size" : "76x76",
      "scale" : "2x"
    },
    {
      "idiom" : "ipad",
      "size" : "83.5x83.5",
      "scale" : "2x"
    },
    {
      "idiom" : "ios-marketing",
      "size" : "1024x1024",
      "scale" : "1x"
    }
  ],
  "info" : {
    "version" : 1,
    "author" : "xcode"
  }
}

================================================
FILE: HeatMap/Assets.xcassets/Contents.json
================================================
{
  "info" : {
    "version" : 1,
    "author" : "xcode"
  }
}

================================================
FILE: HeatMap/Base.lproj/LaunchScreen.storyboard
================================================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
    <dependencies>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
    </dependencies>
    <scenes>
        <!--View Controller-->
        <scene sceneID="EHf-IW-A2E">
            <objects>
                <viewController id="01J-lp-oVM" sceneMemberID="viewController">
                    <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                        <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                        <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
                    </view>
                </viewController>
                <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
            </objects>
            <point key="canvasLocation" x="53" y="375"/>
        </scene>
    </scenes>
</document>


================================================
FILE: HeatMap/Base.lproj/Main.storyboard
================================================
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14269.12" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BV1-FR-VrT">
    <device id="retina4_7" orientation="portrait">
        <adaptation id="fullscreen"/>
    </device>
    <dependencies>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14252.5"/>
        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
    </dependencies>
    <scenes>
        <!--View Controller-->
        <scene sceneID="tXr-a1-R10">
            <objects>
                <viewController id="BV1-FR-VrT" customClass="ViewController" customModule="HeatMap" customModuleProvider="target" sceneMemberID="viewController">
                    <arscnView key="view" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="BrB-h1-WRS">
                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                    </arscnView>
                    <connections>
                        <outlet property="sceneView" destination="BrB-h1-WRS" id="5nT-qQ-ynl"/>
                    </connections>
                </viewController>
                <placeholder placeholderIdentifier="IBFirstResponder" id="SZV-WD-TEh" sceneMemberID="firstResponder"/>
            </objects>
        </scene>
    </scenes>
</document>


================================================
FILE: HeatMap/EyeLasers.swift
================================================
//
//  EyeLasers.swift
//  HeatMap
//
//  Created by Andrew Zimmer on 6/11/18.
//  Copyright © 2018 AndrewZimmer. All rights reserved.
//

import Foundation
import ARKit
import SceneKit

class EyeLasers : SCNNode {
    var startLeftEye : simd_float3?;
    var endLeftEye : simd_float3?;
    
    var startRightEye : simd_float3?;
    var endRightEye : simd_float3?;
    
    let leftEyeCylinder: SCNNode
    let rightEyeCylinder: SCNNode
    
    init(geometry: ARSCNFaceGeometry) {
        leftEyeCylinder = SCNNode(geometry: SCNCylinder(radius: 0.005, height: 0.1))
        rightEyeCylinder = SCNNode(geometry: SCNCylinder(radius: 0.005, height: 0.1))
        
        leftEyeCylinder.geometry?.firstMaterial?.diffuse.contents = UIColor.green
        rightEyeCylinder.geometry?.firstMaterial?.diffuse.contents = UIColor.red
        leftEyeCylinder.opacity = 0.5
        rightEyeCylinder.opacity = 0.5
        
        rightEyeCylinder.renderingOrder = 100;
        leftEyeCylinder.renderingOrder = 100;
        rightEyeCylinder.geometry?.firstMaterial?.readsFromDepthBuffer = false;
        leftEyeCylinder.geometry?.firstMaterial?.readsFromDepthBuffer = false;
        
        super.init()

        addChildNode(leftEyeCylinder)
        addChildNode(rightEyeCylinder)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("\(#function) has not been implemented")
    }
    
    
    // MARK: ARKit Updates
    func update(withFaceAnchor anchor: ARFaceAnchor) {
        if #available(iOS 12.0, *) {
            let leftEyeTransform = anchor.leftEyeTransform
            let rotate:matrix_float4x4 =
                simd_float4x4(SCNMatrix4Mult(SCNMatrix4MakeRotation(-Float.pi / 2.0, 1, 0, 0), SCNMatrix4MakeTranslation(0, 0, 0.1/2)))
            
            leftEyeCylinder.simdTransform = leftEyeTransform * rotate;
            rightEyeCylinder.simdTransform = anchor.rightEyeTransform * rotate;
        } else {
            
        };
    }
}


================================================
FILE: HeatMap/HeatMap.metal
================================================
//
//  HeatMap.metal
//  HeatMap
//
//  Created by Andrew Zimmer on 6/18/18.
//  Copyright © 2018 AndrewZimmer. All rights reserved.
//

#include <metal_stdlib>
using namespace metal;
#include <SceneKit/scn_metal>

struct MyNodeBuffer {
    float4x4 modelTransform;
    float4x4 modelViewTransform;
    float4x4 normalTransform;
    float4x4 modelViewProjectionTransform;
};

typedef struct {
    float3 position [[ attribute(SCNVertexSemanticPosition) ]];
    float2 uv [[ attribute(SCNVertexSemanticTexcoord0)]];
} MyVertexInput;

struct SimpleVertex
{
    float4 position [[position]];
    float2 uv [[texcoord0]];
};

half4 ColorForHeat(float heat) {
    float pval = 4.0 * (1.0 - heat) + 0.99;
    float lb = pval - floor (pval);
    int pvalCategory = abs(int(floor(pval)));
    
    switch (pvalCategory) {
        case 0:
            return half4(1.0, 1.0 - lb, 1.0 - lb, heat);
            
        case 1:
            return half4(1.0, lb, 0.0, heat);
            
        case 2:
            return half4(1.0 - lb, 1.0, 0.0, heat);
            
        case 3:
            return half4(0.0, 1.0, lb, heat);
            
        case 4:
            return half4(0.0, 1.0 - lb, 1.0, heat);
            
        case 5:
            return half4(0.0, 0.0, 1.0 - lb, heat);
    }
    
    return half4(1.0, 1.0, 1.0, heat);
}

vertex SimpleVertex heatMapVert(MyVertexInput in [[ stage_in ]],
                             constant SCNSceneBuffer& scn_frame [[buffer(0)]],
                             constant MyNodeBuffer& scn_node [[buffer(1)]])
{
    SimpleVertex vert;
    vert.position = float4(in.position, 1.0);
    vert.uv = in.uv;
    
    return vert;
}

fragment half4 heatMapFrag(SimpleVertex in [[stage_in]],
                           device r8unorm<float> *heatmapTexture [[buffer(0)]])
{
    // This has a rounding error. Fix by using a real texture2D for displaying the heatmap instead of a dang buffer.    
    int x = round(in.uv.x * 375 * 3);
    int y = round(in.uv.y * 812 * 3);
    int index = x + y * 375 * 3;
    
    float value = heatmapTexture[index];
    return ColorForHeat(value);
}




================================================
FILE: HeatMap/Info.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>$(DEVELOPMENT_LANGUAGE)</string>
	<key>CFBundleExecutable</key>
	<string>$(EXECUTABLE_NAME)</string>
	<key>CFBundleIdentifier</key>
	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>$(PRODUCT_NAME)</string>
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleShortVersionString</key>
	<string>1.0</string>
	<key>CFBundleVersion</key>
	<string>1</string>
	<key>LSRequiresIPhoneOS</key>
	<true/>
	<key>NSCameraUsageDescription</key>
	<string>This application will use the camera for Augmented Reality.</string>
	<key>UILaunchStoryboardName</key>
	<string>LaunchScreen</string>
	<key>UIMainStoryboardFile</key>
	<string>Main</string>
	<key>UIRequiredDeviceCapabilities</key>
	<array>
		<string>armv7</string>
		<string>arkit</string>
	</array>
	<key>UIStatusBarHidden</key>
	<true/>
	<key>UISupportedInterfaceOrientations</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationLandscapeLeft</string>
		<string>UIInterfaceOrientationLandscapeRight</string>
	</array>
	<key>UISupportedInterfaceOrientations~ipad</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationPortraitUpsideDown</string>
		<string>UIInterfaceOrientationLandscapeLeft</string>
		<string>UIInterfaceOrientationLandscapeRight</string>
	</array>
</dict>
</plist>


================================================
FILE: HeatMap/RaycastData.swift
================================================
//
//  RaycastData.swift
//  HeatMap
//
//  Created by Andrew Zimmer on 6/12/18.
//  Copyright © 2018 AndrewZimmer. All rights reserved.
//

import Foundation
import ARKit
import SceneKit

class RaycastData : SCNNode {
    let floatRaycastDistance:Float = 1;
    let leftEye: SCNNode
    let rightEye: SCNNode
    
    let leftEyeEnd : SCNNode
    let rightEyeEnd : SCNNode
    
    init(geometry: ARSCNFaceGeometry) {
        leftEye = SCNNode()
        rightEye = SCNNode()
        
        leftEye.opacity = 0
        rightEye.opacity = 0
        
        leftEyeEnd = SCNNode();
        leftEye.addChildNode(leftEyeEnd)
        leftEyeEnd.simdPosition = simd_float3(0,0, floatRaycastDistance);
        
        rightEyeEnd = SCNNode();
        rightEye.addChildNode(rightEyeEnd)
        rightEyeEnd.simdPosition = simd_float3(0,0, floatRaycastDistance);
        
        super.init()
        
        addChildNode(leftEye)
        addChildNode(rightEye)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("\(#function) has not been implemented")
    }
    
    
    // MARK: ARKit Updates
    func update(withFaceAnchor anchor: ARFaceAnchor) {
        if #available(iOS 12.0, *) {
            leftEye.simdTransform = anchor.leftEyeTransform;
            rightEye.simdTransform = anchor.rightEyeTransform;
        } else {
            
        };
    }
}


================================================
FILE: HeatMap/ViewController.swift
================================================
//
//  ViewController.swift
//  HeatMap
//
//  Created by Andrew Zimmer on 6/11/18.
//  Copyright © 2018 AndrewZimmer. All rights reserved.
//

import UIKit
import SceneKit
import ARKit

class ViewController: UIViewController, ARSCNViewDelegate {

    @IBOutlet var sceneView: ARSCNView!
    
    let phoneWidth = 375 * 3;
    let phoneHeight = 812 * 3;
    
    var m_data : [UInt8] = [UInt8](repeating: 0, count: 375*3 * 812*3)
    
    var positions: Array<simd_float2> = Array()
    let numPositions = 10;
    
    var eyeLasers : EyeLasers?
    var eyeRaycastData : RaycastData?
    var virtualPhoneNode: SCNNode = SCNNode()
    
    var virtualScreenNode: SCNNode = {
        
        let screenGeometry = SCNPlane(width: 1, height: 1)
        screenGeometry.firstMaterial?.isDoubleSided = true
        screenGeometry.firstMaterial?.diffuse.contents = UIColor.green
        
        return SCNNode(geometry: screenGeometry)
    }()
    
    var testSphereStart : SCNNode = {
        let node = SCNNode(geometry: SCNSphere(radius: 0.01))
        node.geometry?.firstMaterial?.diffuse.contents = UIColor.purple
        return node
    }()
    
    var testSphereEnd : SCNNode = {
        let node = SCNNode(geometry: SCNSphere(radius: 0.01))
        node.geometry?.firstMaterial?.diffuse.contents = UIColor.yellow
        return node
    }()
    
    var heatMapNode:SCNNode = {
        let node = SCNNode(geometry:SCNPlane(width: 2, height: 2))  // -1 to 1
        
        let program = SCNProgram()
        program.vertexFunctionName = "heatMapVert"
        program.fragmentFunctionName = "heatMapFrag"
        
        node.geometry?.firstMaterial?.program = program;
        node.geometry?.firstMaterial?.blendMode = SCNBlendMode.add;
        
        return node;
    } ()
    
    var target : UIView = UIView()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        target.backgroundColor = UIColor.red
        target.frame = CGRect.init(x: 0,y:0 ,width:25 ,height:25)
        target.layer.cornerRadius = 12.5
        sceneView.addSubview(target)
        
        // Set the view's delegate
        sceneView.delegate = self
        //sceneView.session.delegate = self
        sceneView.automaticallyUpdatesLighting = true
        
        // Show statistics such as fps and timing information
        sceneView.showsStatistics = true
        
        let device = sceneView.device!
        let eyeGeometry = ARSCNFaceGeometry(device: device)!
        eyeLasers = EyeLasers(geometry: eyeGeometry)
        eyeRaycastData = RaycastData(geometry: eyeGeometry)
        sceneView.scene.rootNode.addChildNode(eyeLasers!)
        sceneView.scene.rootNode.addChildNode(eyeRaycastData!)
        
        virtualPhoneNode.geometry?.firstMaterial?.isDoubleSided = true
        virtualPhoneNode.addChildNode(virtualScreenNode)

        sceneView.scene.rootNode.addChildNode(heatMapNode)
        
        //sceneView.scene.rootNode.addChildNode(testSphereStart)
        //sceneView.scene.rootNode.addChildNode(testSphereEnd)
        self.sceneView.scene.rootNode.addChildNode(virtualPhoneNode)
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        
        // Create a session configuration
        let configuration = ARFaceTrackingConfiguration()

        // Run the view's session
        sceneView.session.run(configuration)
    }
    
    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        
        // Pause the view's session
        sceneView.session.pause()
    }

    // MARK: - ARSCNViewDelegate
    

    // Override to create and configure nodes for anchors added to the view's session.
    func renderer(_ renderer: SCNSceneRenderer, nodeFor anchor: ARAnchor) -> SCNNode? {
        let node = SCNNode()
     
        return node
    }
    
    func session(_ session: ARSession, didFailWithError error: Error) {
        // Present an error message to the user
    }
    
    func sessionWasInterrupted(_ session: ARSession) {
        // Inform the user that the session has been interrupted, for example, by presenting an overlay
        
    }
    
    func sessionInterruptionEnded(_ session: ARSession) {
        // Reset tracking and/or remove existing anchors if consistent tracking is required
    }
    
    func renderer(_ renderer: SCNSceneRenderer, didUpdate node: SCNNode, for anchor: ARAnchor) {
        guard let faceAnchor = anchor as? ARFaceAnchor else { return }
        eyeLasers?.transform = node.transform;
        eyeRaycastData?.transform = node.transform;
        eyeLasers?.update(withFaceAnchor: faceAnchor)
        eyeRaycastData?.update(withFaceAnchor: faceAnchor)
    }
    
    func renderer(_ renderer: SCNSceneRenderer, updateAtTime time: TimeInterval) {
        virtualPhoneNode.transform = (sceneView.pointOfView?.transform)!
        
        let options : [String: Any] = [SCNHitTestOption.backFaceCulling.rawValue: false,
                                       SCNHitTestOption.searchMode.rawValue: 1,
                                       SCNHitTestOption.ignoreChildNodes.rawValue : false,
                                       SCNHitTestOption.ignoreHiddenNodes.rawValue : false]
        
        testSphereStart.worldPosition = self.eyeRaycastData!.leftEye.worldPosition
        testSphereEnd.worldPosition = self.eyeRaycastData!.leftEyeEnd.worldPosition
        
        let hitTestLeftEye = virtualPhoneNode.hitTestWithSegment(
            from: virtualPhoneNode.convertPosition(self.eyeRaycastData!.leftEye.worldPosition, from:nil),
            to:  virtualPhoneNode.convertPosition(self.eyeRaycastData!.leftEyeEnd.worldPosition, from:nil),
            //from: self.eyeRaycastData!.leftEye.worldPosition,
            //to:  self.eyeRaycastData!.leftEyeEnd.worldPosition,
            options: options)
        
        let hitTestRightEye = virtualPhoneNode.hitTestWithSegment(
            from: virtualPhoneNode.convertPosition(self.eyeRaycastData!.rightEye.worldPosition, from:nil),
            to:  virtualPhoneNode.convertPosition(self.eyeRaycastData!.rightEyeEnd.worldPosition, from:nil),
            //from: self.eyeRaycastData!.rightEye.worldPosition,
            //to:  self.eyeRaycastData!.rightEyeEnd.worldPosition,
            options: options)
        
        if (hitTestLeftEye.count > 0 && hitTestRightEye.count > 0) {
            
            var coords = screenPositionFromHittest(hitTestLeftEye[0], secondResult:hitTestRightEye[0])
            //print("x:\(coords.x) y: \(coords.y)")
            
            incrementHeatMapAtPosition(x:Int(coords.x * 3), y:Int(coords.y * 3))  // convert from points to pixels here
            
            let nsdata = NSData.init(bytes: &m_data, length: phoneWidth * phoneHeight)
            heatMapNode.geometry?.firstMaterial?.setValue(nsdata, forKey: "heatmapTexture")
            
            DispatchQueue.main.async(execute: {() -> Void in
                self.target.center = CGPoint.init(x: CGFloat(coords.x), y:CGFloat(coords.y))
            })
        }
    }
    
    func screenPositionFromHittest(_ result1: SCNHitTestResult, secondResult result2: SCNHitTestResult) -> simd_float2 {
        let iPhoneXPointSize = simd_float2(375, 812)  // size of iPhoneX in points
        let iPhoneXMeterSize = simd_float2(0.0623908297, 0.135096943231532)

        let xLC = ((result1.localCoordinates.x + result2.localCoordinates.x) / 2.0)
        var x = xLC / (iPhoneXMeterSize.x / 2.0) * iPhoneXPointSize.x
        
        let yLC = -((result1.localCoordinates.y + result2.localCoordinates.y) / 2.0);
        var y = yLC / (iPhoneXMeterSize.y / 2.0) * iPhoneXPointSize.y + 312
        
        // The 312 points adjustment above is presumably to adjust for the Extrinsics on the iPhone camera.
        // I didn't calculate them and instead ripped them from :
        // https://github.com/virakri/eye-tracking-ios-prototype/blob/master/Eyes%20Tracking/ViewController.swift
        // Probably better to get real values from measuring the camera position to the center of the screen.
        
        x = Float.maximum(Float.minimum(x, iPhoneXPointSize.x-1), 0)
        y = Float.maximum(Float.minimum(y, iPhoneXPointSize.y-1), 0)
        
        // Do just a bit of smoothing. Nothing crazy.
        positions.append(simd_float2(x,y));
        if positions.count > numPositions {
            positions.removeFirst()
        }
        
        var total = simd_float2(0,0);
        for pos in positions {
            total.x += pos.x
            total.y += pos.y
        }
        
        total.x /= Float(positions.count)
        total.y /= Float(positions.count)
        
        return total
    }

    /** Note. I'm not using this because I couldn't figure out how to set an MTLTexture to an SCNProgram because Scenekit has terrible
        documentation. That said you should DEFINITELY fix this if you ever plan to use something like this in production.
        So I left it in for reference. */
    func metalTextureFromArray(_ array:[UInt8], width:Int, height:Int) -> MTLTexture {
        let textureDescriptor = MTLTextureDescriptor.texture2DDescriptor(pixelFormat: MTLPixelFormat.a8Unorm, width: width, height: height, mipmapped: false)
        
        let texture = self.sceneView.device?.makeTexture(descriptor: textureDescriptor)
        let region = MTLRegion(origin: MTLOriginMake(0, 0, 0), size: MTLSizeMake(width, height, 1))
        texture?.replace(region: region, mipmapLevel: 0, withBytes: array, bytesPerRow: width)
        
        return texture!
    }
    
    func incrementHeatMapAtPosition(x: Int, y: Int) {
        let radius:Int = 46; // in pixels
        let maxIncrement:Float = 25;
        
        for curX in x - radius ... x + radius {
            for curY in y - radius ... y + radius {
                let idx = posToIndex(x:curX, y:curY)
                
                if (idx != -1) {
                    let offset = simd_float2(Float(curX - x), Float(curY - y));
                    let len = simd_length(offset)
                    
                    if (len >= Float(radius)) {
                        continue;
                    }

                    let incrementValue = Int((1 - (len / Float(radius))) * maxIncrement);
                    if (255 - m_data[idx] > incrementValue) {
                        m_data[idx] = UInt8(Int(m_data[idx]) + incrementValue)
                    } else {
                        m_data[idx] = 255
                    }
                }
            }
        }
    }
    
    func posToIndex(x:Int, y:Int) -> Int {
        if (x < 0 || x >= phoneWidth ||
            y < 0 || y >= phoneHeight) {
            return -1;
        }
        
        return x + y * phoneWidth;
    }
}


================================================
FILE: HeatMap.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
	archiveVersion = 1;
	classes = {
	};
	objectVersion = 50;
	objects = {

/* Begin PBXBuildFile section */
		5A92A71D20CEECB9002C1111 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A92A71C20CEECB9002C1111 /* AppDelegate.swift */; };
		5A92A72120CEECB9002C1111 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A92A72020CEECB9002C1111 /* ViewController.swift */; };
		5A92A72420CEECB9002C1111 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5A92A72220CEECB9002C1111 /* Main.storyboard */; };
		5A92A72620CEECBA002C1111 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5A92A72520CEECBA002C1111 /* Assets.xcassets */; };
		5A92A72920CEECBB002C1111 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5A92A72720CEECBB002C1111 /* LaunchScreen.storyboard */; };
		5A92A73320CEF604002C1111 /* EyeLasers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A92A73220CEF604002C1111 /* EyeLasers.swift */; };
		5A92A73520D02EE2002C1111 /* RaycastData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A92A73420D02EE2002C1111 /* RaycastData.swift */; };
		5ACC4C6620D85D5000B91E25 /* HeatMap.metal in Sources */ = {isa = PBXBuildFile; fileRef = 5ACC4C6520D85D5000B91E25 /* HeatMap.metal */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
		5A92A71920CEECB9002C1111 /* HeatMap.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HeatMap.app; sourceTree = BUILT_PRODUCTS_DIR; };
		5A92A71C20CEECB9002C1111 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
		5A92A72020CEECB9002C1111 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
		5A92A72320CEECB9002C1111 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
		5A92A72520CEECBA002C1111 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
		5A92A72820CEECBB002C1111 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
		5A92A72A20CEECBB002C1111 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
		5A92A73220CEF604002C1111 /* EyeLasers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EyeLasers.swift; sourceTree = "<group>"; };
		5A92A73420D02EE2002C1111 /* RaycastData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RaycastData.swift; sourceTree = "<group>"; };
		5ACC4C6520D85D5000B91E25 /* HeatMap.metal */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.metal; path = HeatMap.metal; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
		5A92A71620CEECB9002C1111 /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
		5A92A71020CEECB9002C1111 = {
			isa = PBXGroup;
			children = (
				5A92A71B20CEECB9002C1111 /* HeatMap */,
				5A92A71A20CEECB9002C1111 /* Products */,
			);
			sourceTree = "<group>";
		};
		5A92A71A20CEECB9002C1111 /* Products */ = {
			isa = PBXGroup;
			children = (
				5A92A71920CEECB9002C1111 /* HeatMap.app */,
			);
			name = Products;
			sourceTree = "<group>";
		};
		5A92A71B20CEECB9002C1111 /* HeatMap */ = {
			isa = PBXGroup;
			children = (
				5A92A73220CEF604002C1111 /* EyeLasers.swift */,
				5A92A73420D02EE2002C1111 /* RaycastData.swift */,
				5A92A71C20CEECB9002C1111 /* AppDelegate.swift */,
				5A92A72020CEECB9002C1111 /* ViewController.swift */,
				5A92A72520CEECBA002C1111 /* Assets.xcassets */,
				5A92A72220CEECB9002C1111 /* Main.storyboard */,
				5A92A72720CEECBB002C1111 /* LaunchScreen.storyboard */,
				5A92A72A20CEECBB002C1111 /* Info.plist */,
				5ACC4C6520D85D5000B91E25 /* HeatMap.metal */,
			);
			path = HeatMap;
			sourceTree = "<group>";
		};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
		5A92A71820CEECB9002C1111 /* HeatMap */ = {
			isa = PBXNativeTarget;
			buildConfigurationList = 5A92A72D20CEECBB002C1111 /* Build configuration list for PBXNativeTarget "HeatMap" */;
			buildPhases = (
				5A92A71520CEECB9002C1111 /* Sources */,
				5A92A71620CEECB9002C1111 /* Frameworks */,
				5A92A71720CEECB9002C1111 /* Resources */,
			);
			buildRules = (
			);
			dependencies = (
			);
			name = HeatMap;
			productName = HeatMap;
			productReference = 5A92A71920CEECB9002C1111 /* HeatMap.app */;
			productType = "com.apple.product-type.application";
		};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
		5A92A71120CEECB9002C1111 /* Project object */ = {
			isa = PBXProject;
			attributes = {
				LastSwiftUpdateCheck = 1000;
				LastUpgradeCheck = 1000;
				ORGANIZATIONNAME = AndrewZimmer;
				TargetAttributes = {
					5A92A71820CEECB9002C1111 = {
						CreatedOnToolsVersion = 10.0;
					};
				};
			};
			buildConfigurationList = 5A92A71420CEECB9002C1111 /* Build configuration list for PBXProject "HeatMap" */;
			compatibilityVersion = "Xcode 9.3";
			developmentRegion = en;
			hasScannedForEncodings = 0;
			knownRegions = (
				en,
				Base,
			);
			mainGroup = 5A92A71020CEECB9002C1111;
			productRefGroup = 5A92A71A20CEECB9002C1111 /* Products */;
			projectDirPath = "";
			projectRoot = "";
			targets = (
				5A92A71820CEECB9002C1111 /* HeatMap */,
			);
		};
/* End PBXProject section */

/* Begin PBXResourcesBuildPhase section */
		5A92A71720CEECB9002C1111 /* Resources */ = {
			isa = PBXResourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				5A92A72920CEECBB002C1111 /* LaunchScreen.storyboard in Resources */,
				5A92A72620CEECBA002C1111 /* Assets.xcassets in Resources */,
				5A92A72420CEECB9002C1111 /* Main.storyboard in Resources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
		5A92A71520CEECB9002C1111 /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				5A92A72120CEECB9002C1111 /* ViewController.swift in Sources */,
				5ACC4C6620D85D5000B91E25 /* HeatMap.metal in Sources */,
				5A92A73520D02EE2002C1111 /* RaycastData.swift in Sources */,
				5A92A71D20CEECB9002C1111 /* AppDelegate.swift in Sources */,
				5A92A73320CEF604002C1111 /* EyeLasers.swift in Sources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
		5A92A72220CEECB9002C1111 /* Main.storyboard */ = {
			isa = PBXVariantGroup;
			children = (
				5A92A72320CEECB9002C1111 /* Base */,
			);
			name = Main.storyboard;
			sourceTree = "<group>";
		};
		5A92A72720CEECBB002C1111 /* LaunchScreen.storyboard */ = {
			isa = PBXVariantGroup;
			children = (
				5A92A72820CEECBB002C1111 /* Base */,
			);
			name = LaunchScreen.storyboard;
			sourceTree = "<group>";
		};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
		5A92A72B20CEECBB002C1111 /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_SEARCH_USER_PATHS = NO;
				CLANG_ANALYZER_NONNULL = YES;
				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
				CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
				CLANG_CXX_LIBRARY = "libc++";
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				CLANG_ENABLE_OBJC_WEAK = YES;
				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
				CLANG_WARN_BOOL_CONVERSION = YES;
				CLANG_WARN_COMMA = YES;
				CLANG_WARN_CONSTANT_CONVERSION = YES;
				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
				CLANG_WARN_EMPTY_BODY = YES;
				CLANG_WARN_ENUM_CONVERSION = YES;
				CLANG_WARN_INFINITE_RECURSION = YES;
				CLANG_WARN_INT_CONVERSION = YES;
				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
				CLANG_WARN_STRICT_PROTOTYPES = YES;
				CLANG_WARN_SUSPICIOUS_MOVE = YES;
				CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
				CLANG_WARN_UNREACHABLE_CODE = YES;
				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
				CODE_SIGN_IDENTITY = "iPhone Developer";
				COPY_PHASE_STRIP = NO;
				DEBUG_INFORMATION_FORMAT = dwarf;
				ENABLE_STRICT_OBJC_MSGSEND = YES;
				ENABLE_TESTABILITY = YES;
				GCC_C_LANGUAGE_STANDARD = gnu11;
				GCC_DYNAMIC_NO_PIC = NO;
				GCC_NO_COMMON_BLOCKS = YES;
				GCC_OPTIMIZATION_LEVEL = 0;
				GCC_PREPROCESSOR_DEFINITIONS = (
					"DEBUG=1",
					"$(inherited)",
				);
				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
				GCC_WARN_UNDECLARED_SELECTOR = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
				GCC_WARN_UNUSED_FUNCTION = YES;
				GCC_WARN_UNUSED_VARIABLE = YES;
				IPHONEOS_DEPLOYMENT_TARGET = 12.0;
				MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
				ONLY_ACTIVE_ARCH = YES;
				SDKROOT = iphoneos;
				SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
			};
			name = Debug;
		};
		5A92A72C20CEECBB002C1111 /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_SEARCH_USER_PATHS = NO;
				CLANG_ANALYZER_NONNULL = YES;
				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
				CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
				CLANG_CXX_LIBRARY = "libc++";
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				CLANG_ENABLE_OBJC_WEAK = YES;
				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
				CLANG_WARN_BOOL_CONVERSION = YES;
				CLANG_WARN_COMMA = YES;
				CLANG_WARN_CONSTANT_CONVERSION = YES;
				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
				CLANG_WARN_EMPTY_BODY = YES;
				CLANG_WARN_ENUM_CONVERSION = YES;
				CLANG_WARN_INFINITE_RECURSION = YES;
				CLANG_WARN_INT_CONVERSION = YES;
				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
				CLANG_WARN_STRICT_PROTOTYPES = YES;
				CLANG_WARN_SUSPICIOUS_MOVE = YES;
				CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
				CLANG_WARN_UNREACHABLE_CODE = YES;
				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
				CODE_SIGN_IDENTITY = "iPhone Developer";
				COPY_PHASE_STRIP = NO;
				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
				ENABLE_NS_ASSERTIONS = NO;
				ENABLE_STRICT_OBJC_MSGSEND = YES;
				GCC_C_LANGUAGE_STANDARD = gnu11;
				GCC_NO_COMMON_BLOCKS = YES;
				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
				GCC_WARN_UNDECLARED_SELECTOR = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
				GCC_WARN_UNUSED_FUNCTION = YES;
				GCC_WARN_UNUSED_VARIABLE = YES;
				IPHONEOS_DEPLOYMENT_TARGET = 12.0;
				MTL_ENABLE_DEBUG_INFO = NO;
				SDKROOT = iphoneos;
				SWIFT_COMPILATION_MODE = wholemodule;
				SWIFT_OPTIMIZATION_LEVEL = "-O";
				VALIDATE_PRODUCT = YES;
			};
			name = Release;
		};
		5A92A72E20CEECBB002C1111 /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
				CODE_SIGN_STYLE = Automatic;
				DEVELOPMENT_TEAM = NLASH8BTJ5;
				INFOPLIST_FILE = HeatMap/Info.plist;
				LD_RUNPATH_SEARCH_PATHS = (
					"$(inherited)",
					"@executable_path/Frameworks",
				);
				PRODUCT_BUNDLE_IDENTIFIER = AZ.HeatMap;
				PRODUCT_NAME = "$(TARGET_NAME)";
				SWIFT_VERSION = 4.2;
				TARGETED_DEVICE_FAMILY = "1,2";
			};
			name = Debug;
		};
		5A92A72F20CEECBB002C1111 /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
				CODE_SIGN_STYLE = Automatic;
				DEVELOPMENT_TEAM = NLASH8BTJ5;
				INFOPLIST_FILE = HeatMap/Info.plist;
				LD_RUNPATH_SEARCH_PATHS = (
					"$(inherited)",
					"@executable_path/Frameworks",
				);
				PRODUCT_BUNDLE_IDENTIFIER = AZ.HeatMap;
				PRODUCT_NAME = "$(TARGET_NAME)";
				SWIFT_VERSION = 4.2;
				TARGETED_DEVICE_FAMILY = "1,2";
			};
			name = Release;
		};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
		5A92A71420CEECB9002C1111 /* Build configuration list for PBXProject "HeatMap" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				5A92A72B20CEECBB002C1111 /* Debug */,
				5A92A72C20CEECBB002C1111 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		5A92A72D20CEECBB002C1111 /* Build configuration list for PBXNativeTarget "HeatMap" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				5A92A72E20CEECBB002C1111 /* Debug */,
				5A92A72F20CEECBB002C1111 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
/* End XCConfigurationList section */
	};
	rootObject = 5A92A71120CEECB9002C1111 /* Project object */;
}


================================================
FILE: HeatMap.xcodeproj/project.xcworkspace/contents.xcworkspacedata
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
   version = "1.0">
   <FileRef
      location = "self:HeatMap.xcodeproj">
   </FileRef>
</Workspace>


================================================
FILE: HeatMap.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>IDEDidComputeMac32BitWarning</key>
	<true/>
</dict>
</plist>


================================================
FILE: HeatMap.xcodeproj/xcuserdata/andrewzimmer.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
   type = "1"
   version = "2.0">
   <Breakpoints>
      <BreakpointProxy
         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
         <BreakpointContent
            shouldBeEnabled = "No"
            ignoreCount = "0"
            continueAfterRunningActions = "No"
            filePath = "HeatMap/ViewController.swift"
            timestampString = "551227566.357581"
            startingColumnNumber = "9223372036854775807"
            endingColumnNumber = "9223372036854775807"
            startingLineNumber = "139"
            endingLineNumber = "139"
            landmarkName = "renderer(_:didUpdate:for:)"
            landmarkType = "7">
         </BreakpointContent>
      </BreakpointProxy>
      <BreakpointProxy
         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
         <BreakpointContent
            shouldBeEnabled = "No"
            ignoreCount = "0"
            continueAfterRunningActions = "No"
            filePath = "HeatMap/ViewController.swift"
            timestampString = "551227566.358811"
            startingColumnNumber = "9223372036854775807"
            endingColumnNumber = "9223372036854775807"
            startingLineNumber = "147"
            endingLineNumber = "147"
            landmarkName = "renderer(_:updateAtTime:)"
            landmarkType = "7">
         </BreakpointContent>
      </BreakpointProxy>
      <BreakpointProxy
         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
         <BreakpointContent
            shouldBeEnabled = "No"
            ignoreCount = "0"
            continueAfterRunningActions = "No"
            filePath = "HeatMap/ViewController.swift"
            timestampString = "551227566.359816"
            startingColumnNumber = "9223372036854775807"
            endingColumnNumber = "9223372036854775807"
            startingLineNumber = "138"
            endingLineNumber = "138"
            landmarkName = "renderer(_:didUpdate:for:)"
            landmarkType = "7">
         </BreakpointContent>
      </BreakpointProxy>
      <BreakpointProxy
         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
         <BreakpointContent
            shouldBeEnabled = "No"
            ignoreCount = "0"
            continueAfterRunningActions = "No"
            filePath = "HeatMap/ViewController.swift"
            timestampString = "551227566.360821"
            startingColumnNumber = "9223372036854775807"
            endingColumnNumber = "9223372036854775807"
            startingLineNumber = "157"
            endingLineNumber = "157"
            landmarkName = "renderer(_:updateAtTime:)"
            landmarkType = "7">
         </BreakpointContent>
      </BreakpointProxy>
      <BreakpointProxy
         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
         <BreakpointContent
            shouldBeEnabled = "No"
            ignoreCount = "0"
            continueAfterRunningActions = "No"
            filePath = "HeatMap/ViewController.swift"
            timestampString = "551227566.361791"
            startingColumnNumber = "9223372036854775807"
            endingColumnNumber = "9223372036854775807"
            startingLineNumber = "154"
            endingLineNumber = "154"
            landmarkName = "renderer(_:updateAtTime:)"
            landmarkType = "7">
         </BreakpointContent>
      </BreakpointProxy>
      <BreakpointProxy
         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
         <BreakpointContent
            shouldBeEnabled = "No"
            ignoreCount = "0"
            continueAfterRunningActions = "No"
            filePath = "HeatMap/ViewController.swift"
            timestampString = "551227566.362821"
            startingColumnNumber = "9223372036854775807"
            endingColumnNumber = "9223372036854775807"
            startingLineNumber = "149"
            endingLineNumber = "149"
            landmarkName = "renderer(_:updateAtTime:)"
            landmarkType = "7">
         </BreakpointContent>
      </BreakpointProxy>
      <BreakpointProxy
         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
         <BreakpointContent
            shouldBeEnabled = "No"
            ignoreCount = "0"
            continueAfterRunningActions = "No"
            filePath = "HeatMap/ViewController.swift"
            timestampString = "551227566.363716"
            startingColumnNumber = "9223372036854775807"
            endingColumnNumber = "9223372036854775807"
            startingLineNumber = "231"
            endingLineNumber = "231"
            landmarkName = "metalTextureFromArray(_:width:height:)"
            landmarkType = "7">
         </BreakpointContent>
      </BreakpointProxy>
      <BreakpointProxy
         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
         <BreakpointContent
            shouldBeEnabled = "No"
            ignoreCount = "0"
            continueAfterRunningActions = "No"
            filePath = "HeatMap/ViewController.swift"
            timestampString = "551227674.978737"
            startingColumnNumber = "9223372036854775807"
            endingColumnNumber = "9223372036854775807"
            startingLineNumber = "14"
            endingLineNumber = "14"
            landmarkName = "ViewController"
            landmarkType = "3">
         </BreakpointContent>
      </BreakpointProxy>
   </Breakpoints>
</Bucket>


================================================
FILE: HeatMap.xcodeproj/xcuserdata/andrewzimmer.xcuserdatad/xcschemes/xcschememanagement.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>SchemeUserState</key>
	<dict>
		<key>HeatMap.xcscheme</key>
		<dict>
			<key>orderHint</key>
			<integer>0</integer>
		</dict>
	</dict>
</dict>
</plist>


================================================
FILE: README.md
================================================
# HeatMapEyeTracking
A quick test with ARKit 2 implementing a heatmap for eye tracking
Download .txt
gitextract_ft8wb4sx/

├── HeatMap/
│   ├── AppDelegate.swift
│   ├── Assets.xcassets/
│   │   ├── AppIcon.appiconset/
│   │   │   └── Contents.json
│   │   └── Contents.json
│   ├── Base.lproj/
│   │   ├── LaunchScreen.storyboard
│   │   └── Main.storyboard
│   ├── EyeLasers.swift
│   ├── HeatMap.metal
│   ├── Info.plist
│   ├── RaycastData.swift
│   └── ViewController.swift
├── HeatMap.xcodeproj/
│   ├── project.pbxproj
│   ├── project.xcworkspace/
│   │   ├── contents.xcworkspacedata
│   │   ├── xcshareddata/
│   │   │   └── IDEWorkspaceChecks.plist
│   │   └── xcuserdata/
│   │       └── andrewzimmer.xcuserdatad/
│   │           └── UserInterfaceState.xcuserstate
│   └── xcuserdata/
│       └── andrewzimmer.xcuserdatad/
│           ├── xcdebugger/
│           │   └── Breakpoints_v2.xcbkptlist
│           └── xcschemes/
│               └── xcschememanagement.plist
└── README.md
Condensed preview — 17 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (49K chars).
[
  {
    "path": "HeatMap/AppDelegate.swift",
    "chars": 2174,
    "preview": "//\n//  AppDelegate.swift\n//  HeatMap\n//\n//  Created by Andrew Zimmer on 6/11/18.\n//  Copyright © 2018 AndrewZimmer. All "
  },
  {
    "path": "HeatMap/Assets.xcassets/AppIcon.appiconset/Contents.json",
    "chars": 1590,
    "preview": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"20x20\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\""
  },
  {
    "path": "HeatMap/Assets.xcassets/Contents.json",
    "chars": 62,
    "preview": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "HeatMap/Base.lproj/LaunchScreen.storyboard",
    "chars": 1658,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard"
  },
  {
    "path": "HeatMap/Base.lproj/Main.storyboard",
    "chars": 1658,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB\" version=\"3"
  },
  {
    "path": "HeatMap/EyeLasers.swift",
    "chars": 1973,
    "preview": "//\n//  EyeLasers.swift\n//  HeatMap\n//\n//  Created by Andrew Zimmer on 6/11/18.\n//  Copyright © 2018 AndrewZimmer. All ri"
  },
  {
    "path": "HeatMap/HeatMap.metal",
    "chars": 2121,
    "preview": "//\n//  HeatMap.metal\n//  HeatMap\n//\n//  Created by Andrew Zimmer on 6/18/18.\n//  Copyright © 2018 AndrewZimmer. All righ"
  },
  {
    "path": "HeatMap/Info.plist",
    "chars": 1642,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "HeatMap/RaycastData.swift",
    "chars": 1383,
    "preview": "//\n//  RaycastData.swift\n//  HeatMap\n//\n//  Created by Andrew Zimmer on 6/12/18.\n//  Copyright © 2018 AndrewZimmer. All "
  },
  {
    "path": "HeatMap/ViewController.swift",
    "chars": 10822,
    "preview": "//\n//  ViewController.swift\n//  HeatMap\n//\n//  Created by Andrew Zimmer on 6/11/18.\n//  Copyright © 2018 AndrewZimmer. A"
  },
  {
    "path": "HeatMap.xcodeproj/project.pbxproj",
    "chars": 13625,
    "preview": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section *"
  },
  {
    "path": "HeatMap.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
    "chars": 152,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:HeatMap.xcodepr"
  },
  {
    "path": "HeatMap.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist",
    "chars": 238,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "HeatMap.xcodeproj/xcuserdata/andrewzimmer.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist",
    "chars": 5440,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Bucket\n   type = \"1\"\n   version = \"2.0\">\n   <Breakpoints>\n      <BreakpointProxy"
  },
  {
    "path": "HeatMap.xcodeproj/xcuserdata/andrewzimmer.xcuserdatad/xcschemes/xcschememanagement.plist",
    "chars": 330,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "README.md",
    "chars": 87,
    "preview": "# HeatMapEyeTracking\nA quick test with ARKit 2 implementing a heatmap for eye tracking\n"
  }
]

// ... and 1 more files (download for full content)

About this extraction

This page contains the full source code of the andrewzimmer906/HeatMapEyeTracking GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 17 files (43.9 KB), approximately 13.1k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!