This file contains 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
class FiveLastPoints { | |
var fiveLastPointsLocation : [CLLocationCoordinate2D] = [] | |
var fiveLastPointsTime : [Int] = [] | |
var totalDistance : Double = 0.0 | |
var totalTime : Int = 0 | |
func addNewPoint(newPoint : CLLocationCoordinate2D, time: Int) { | |
//first add 5 points | |
fiveLastPointsLocation.append(newPoint) |
This file contains 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 isLineStrait(polyline: GMSPath) -> Bool { | |
let pointFrom = CLLocationCoordinate2D(latitude: polyline.coordinate(at: 0).latitude, longitude: polyline.coordinate(at: 0).longitude) | |
let pointTo = CLLocationCoordinate2D(latitude: polyline.coordinate(at: polyline.count() - 1).latitude, longitude: polyline.coordinate(at: polyline.count() - 1).longitude) | |
var equation = (slope: 0.0, intercept: 0.0) | |
equation = getLineEquation(locationFrom: pointFrom, locationTo: pointTo) | |
var numberOfPointNotInThePath = 0 | |
for i in 0...(polyline.count() - 1) { | |
let location = CLLocationCoordinate2D(latitude: polyline.coordinate(at: i).latitude, longitude: polyline.coordinate(at: i).longitude) |
This file contains 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
// | |
// MeasurementFormatter.swift | |
// onTracks | |
// | |
// Created by Xuan Carbone on 31/05/2018. | |
// Copyright © 2018 onTracks. All rights reserved. | |
// | |
import Foundation |