From 3a781280b6a20ba09e8a843a7317ceb678a13ad0 Mon Sep 17 00:00:00 2001 From: Holmes Futrell Date: Fri, 24 May 2019 15:26:08 -0700 Subject: [PATCH] resolve todo --- BezierKit/Library/AugmentedGraph.swift | 1 - BezierKit/Library/Path.swift | 2 +- BezierKit/Library/PathComponent.swift | 4 ++++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/BezierKit/Library/AugmentedGraph.swift b/BezierKit/Library/AugmentedGraph.swift index 3fd5c65a..893afc9e 100644 --- a/BezierKit/Library/AugmentedGraph.swift +++ b/BezierKit/Library/AugmentedGraph.swift @@ -182,7 +182,6 @@ internal class PathLinkedListRepresentation { let prev = startingVertex.emitPrevious() let p = prev.compute(0.5) let n = prev.normal(0.5) - #warning("you need to add an API for this one!") let line = LineSegment(p0: p, p1: p + n) let intersections = path.intersections(with: Path(curve: line)) let s: CGFloat = 0.5 * (intersections.map({$0.indexedPathLocation2.t}).first(where: {$0 > 0}) ?? 1.0) diff --git a/BezierKit/Library/Path.swift b/BezierKit/Library/Path.swift index c19fae6c..1281adc6 100644 --- a/BezierKit/Library/Path.swift +++ b/BezierKit/Library/Path.swift @@ -189,7 +189,7 @@ internal func windingCountImpliesContainment(_ count: Int, using rule: PathFillR } convenience public init(curve: BezierCurve) { - self.init(components: [PathComponent(curves: [curve])]) + self.init(components: [PathComponent(curve: curve)]) } // MARK: - NSCoding diff --git a/BezierKit/Library/PathComponent.swift b/BezierKit/Library/PathComponent.swift index c048c540..5cc282f2 100644 --- a/BezierKit/Library/PathComponent.swift +++ b/BezierKit/Library/PathComponent.swift @@ -140,6 +140,10 @@ import Foundation self.offsets = PathComponent.computeOffsets(from: self.orders) } + convenience public init(curve: BezierCurve) { + self.init(curves: [curve]) + } + private static func computeOffsets(from orders: [Int]) -> [Int] { var offsets = [Int]() offsets.reserveCapacity(orders.count)