- No conflicts
- No warnings
- Builds
- Tests passing
| // | |
| // Vector2D.swift | |
| // | |
| // Created by fewlinesofcode.com on 2/6/19. | |
| // Copyright © 2019 fewlinesofcode.com All rights reserved. | |
| // | |
| import Foundation | |
| struct Vector2D { |
| // | |
| // | |
| // CGVectorArithmetics.swift | |
| // | |
| // Created by fewlinesofcode.com on 2/6/19. | |
| // Copyright © 2019 fewlinesofcode.com All rights reserved. | |
| // | |
| import Foundation | |
| import CoreGraphics |
| /** | |
| * The $1 Unistroke Recognizer | |
| * | |
| * Jacob O. Wobbrock, Ph.D. | |
| * The Information School | |
| * University of Washington | |
| * Seattle, WA 98195-2840 | |
| * [email protected] | |
| * | |
| * Andrew D. Wilson, Ph.D. |
| // | |
| // Created by @fewlinesofcode on 9/6/18. | |
| // Copyright (c) 2018 Oleksandr Glagoliev. All rights reserved. | |
| // | |
| public class Interval<T: Comparable> { | |
| private (set) var start: T | |
| private (set) var end: T | |
| var max: T | |
| import Foundation | |
| public func cross(_ o: CGPoint, _ a: CGPoint, _ b: CGPoint) -> CGFloat { | |
| let lhs = (a.x - o.x) * (b.y - o.y) | |
| let rhs = (a.y - o.y) * (b.x - o.x) | |
| return lhs - rhs | |
| } | |
| /// Calculate and return the convex hull of a given sequence of points. | |
| /// |
| // | |
| // main.swift | |
| // Beachline | |
| // | |
| // Created by Oleksandr Glagoliev on 1/4/20. | |
| // Copyright © 2020 Oleksandr Glagoliev. All rights reserved. | |
| // | |
| import Foundation |
| let dcf = DateComponentsFormatter() | |
| dcf.unitsStyle = .abbreviated | |
| dcf.includesApproximationPhrase = false | |
| dcf.includesTimeRemainingPhrase = true | |
| dcf.allowedUnits = [.day, .hour, .minute, .second] | |
| let past = Date().advanced(by: -10) | |
| let now = Date() | |
| let humanReadableString = dcf.string(from: past, to: now) | |
| print(humanReadableString!) |
| import UIKit | |
| extension UIBezierPath { | |
| private static func midpoint(_ a: CGPoint, b: CGPoint) -> CGPoint { | |
| CGPoint( | |
| x: (b.x + a.x) / 2, | |
| y: (b.y + a.y) / 2 | |
| ) | |
| } | |
| import UIKit | |
| extension UIBezierPath { | |
| private static func addCorner( | |
| _ path: UIBezierPath, | |
| p1: CGPoint, | |
| p: CGPoint, | |
| p2: CGPoint, | |
| radius: CGFloat, | |
| isStart: Bool = false |