Skip to content

Commit

Permalink
Merge pull request #11 from toineheuvelmans/swift4
Browse files Browse the repository at this point in the history
Merge changes for issues 7 and 9
  • Loading branch information
Toine Heuvelmans committed Feb 2, 2018
2 parents cd4c7a9 + 6e437ec commit 876d928
Show file tree
Hide file tree
Showing 7 changed files with 227 additions and 220 deletions.
Expand Up @@ -22,7 +22,7 @@
initialize these types and the properties that can be
derived from them.
NOTE: You will need to build the project first before Metron is available in these playgrounds. Ensure that you have a Simulator-type device selected when building.
NOTE: Run pod install in the Example folder and then open the Xcode workspace. You will need to build the project first before Metron is available in these playgrounds. Ensure that you have a Simulator-type device selected when building.
----
*/
Expand Down
6 changes: 3 additions & 3 deletions Example/Metron.playground/Sources/Playground.swift
Expand Up @@ -3,7 +3,7 @@ import UIKit

// MARK: Playgrounds

extension Drawable {
public extension Metron.Drawable {
public var customPlaygroundQuickLook: PlaygroundQuickLook {
if let path = self.path {
return .bezierPath(UIBezierPath(cgPath: path))
Expand All @@ -16,10 +16,10 @@ extension Drawable {
//extension Circle : CustomPlaygroundQuickLookable {}
//extension Triangle : CustomPlaygroundQuickLookable {}
//extension Square : CustomPlaygroundQuickLookable {}
extension Polygon : CustomPlaygroundQuickLookable {}
extension Metron.Polygon : CustomPlaygroundQuickLookable {}


extension Int {
public extension Int {
public func `do`(_ block: () -> ()) {
guard self > 0 else { return }
for _ in 0..<self {
Expand Down
136 changes: 74 additions & 62 deletions Example/Metron.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -40,6 +40,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -69,6 +70,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
291 changes: 142 additions & 149 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Metron/Classes/Line.swift
Expand Up @@ -79,7 +79,7 @@ public extension Line {
/// - returns: True if this line is horizontal (slope equals zero).
public var isHorizontal: Bool {
if case let .sloped(slope, _) = definition {
return slope == 0.0
return abs(slope) == 0.0
}
return false
}
Expand Down Expand Up @@ -127,10 +127,10 @@ public extension Line {
}

/// - returns: True when the provided point is on this `Line`.
/// - note: An error margin of 1e-14 is allowed.
/// - note: An error margin of 1e-12 is allowed.
public func contains(_ point: CGPoint) -> Bool {
guard let pointAtX = self.point(atX: point.x) else { return false }
return point.distance(to: pointAtX) <= 1e-14
return point.distance(to: pointAtX) <= 1e-12
}

/// - returns: The intersection of this `Line` with the provided `Line`.
Expand Down
2 changes: 1 addition & 1 deletion Metron/Classes/LineSegment.swift
Expand Up @@ -53,7 +53,7 @@ public extension LineSegment {

/// - returns: true when the provided point is on this lineSegment's line and
/// between its points.
/// - note: An error margin of 1e-14 is allowed.
/// - note: An error margin of 1e-12 is allowed.
public func contains(_ point: CGPoint) -> Bool {
if isVertical {
return point.x == minX && point.y.between(lower: a.y, upper: b.y)
Expand Down

0 comments on commit 876d928

Please sign in to comment.