Skip to content

Instantly share code, notes, and snippets.

@dmbfm
dmbfm / GpsUtils.cs
Created October 31, 2020 16:22 — forked from govert/GpsUtils.cs
Convert WGS-84 geodetic locations (GPS readings) to Cartesian coordinates in a local tangent plane (Geodetic to ECEF to ENU)
using System;
using System.Diagnostics;
using static System.Math;
// Some helpers for converting GPS readings from the WGS84 geodetic system to a local North-East-Up cartesian axis.
// The implementation here is according to the paper:
// "Conversion of Geodetic coordinates to the Local Tangent Plane" Version 2.01.
// "The basic reference for this paper is J.Farrell & M.Barth 'The Global Positioning System & Inertial Navigation'"
// Also helpful is Wikipedia: http://en.wikipedia.org/wiki/Geodetic_datum
#include <stdio.h>
#define length(arr) (sizeof(arr)/sizeof(arr[0]))
#define TOKEN_CONCAT_INNER(x, y) x##y
#define TOKEN_CONCAT(x, y) TOKEN_CONCAT_INNER(x, y)
#define LABEL(id) TOKEN_CONCAT(LABEL_##id##_, __LINE__)
#define foreach(type, name, arr) \
// from http://cakoose.com/wiki/c_preprocessor_abuse
#define BIN_0000 0
#define BIN_0001 1
#define BIN_0010 2
#define BIN_0011 3
#define BIN_0100 4
#define BIN_0101 5
#define BIN_0110 6
#define BIN_0111 7
var cameraPos = MathUtils.SetY(mainCamera.transform.position, 0);
var endPos = MathUtils.SetY(transform.position, floorLevel, 0);
var distance = = Vector3.Distance(startPos, endPos);
using ARLocation;
// ...
var placeAtLocation = GetComponent<PlaceAtLocation>();
var label = placeAtLocation.Location.Label;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using ARLocation;
using System;
public class PlaceObjectsLine : MonoBehaviour
{
[Serializable]
public class Entry
using ARLocation;
public class PlaceMyObjects : MonoBehaviour
{
public GameObject Prefab;
void Start()
{
var locations = new List<Location>();
locations.Add(new Location() {
import * as THREE from "three";
import {
BloomEffect,
SelectiveBloomEffect,
EffectComposer,
EffectPass,
RenderPass,
BlendFunction,
KernelSize,
VignetteEffect,
using UnityEngine;
using UnityEditor;
using UnityEditor.Experimental.AssetImporters;
using System.IO;
using System.Xml;
using System.Collections.Generic;
[ScriptedImporter(1, "kml")]
public class KMLPathImporter : ScriptedImporter
import * as THREE from "three";
class Particle {
constructor(mesh, body, meshIndex = 0, lifeTime = 0) {
this.meshIndex = meshIndex;
this.lifeTime = lifeTime;
this.elapsedTime = 0;
this.dead = false;
this.mesh = mesh;
this.body = body;