Created
February 25, 2018 12:22
-
-
Save giginet/486b5950185de202750f7c8558d9e9ff to your computer and use it in GitHub Desktop.
This file contains hidden or 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
diff --git a/DemoBots/GeometryExtensions.swift b/DemoBots/GeometryExtensions.swift | |
index 5c5f97c..e5dc712 100644 | |
--- a/DemoBots/GeometryExtensions.swift | |
+++ b/DemoBots/GeometryExtensions.swift | |
@@ -30,12 +30,6 @@ extension float2 { | |
} | |
} | |
-/* | |
- Extend `float2` to declare conformance to the `Equatable` protocol. | |
- The conformance to the protocol is provided by the `==` operator function below. | |
-*/ | |
-extension float2: Equatable {} | |
- | |
/// An equality operator function to determine if two `float2`s are the same. | |
public func ==(lhs: float2, rhs: float2) -> Bool { | |
return lhs.x == rhs.x && lhs.y == rhs.y | |
@@ -61,8 +55,8 @@ extension float2 { | |
let componentInSegment = projectionAlongSegment / lineLengthSquared | |
// Clamps the component between [0 - 1]. | |
- let fractionOfComponent = max(0, min(1, componentInSegment)) | |
+ let fractionOfComponent = Swift.max(0, Swift.min(1.0, componentInSegment)) | |
return lineSegment.startPoint + lineSegmentVector * fractionOfComponent | |
} | |
-} | |
\ No newline at end of file | |
+} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment