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
// | |
// ReactiveExtensionsCosmos.swift | |
// Route.nl | |
// | |
// Created by Pim Nijman on 07/09/2019. | |
// Copyright © 2019 Falk. All rights reserved. | |
// | |
import Bond | |
import ReactiveKit |
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
extension CLLocation { | |
/// Returns the shortest distance (measured in meters) from the current object's location to the imaginary line running between the two specified locations. | |
/// | |
/// - Parameters: | |
/// - start: The first location that makes up the imaginary line. | |
/// - end: The second location that makes up the imaginary line. | |
/// - Returns: The shortest distance (in meters) between the current object's location and the imaginary line. | |
func distanceToLine(from start: CLLocation, to end: CLLocation) -> CLLocationDistance { | |
let s0lat = degreesToRadians(coordinate.latitude) |