├── .gitignore ├── .swift-version ├── DelaunaySwift.podspec ├── DelaunaySwift.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ ├── DelaunaySwift (MacOS).xcscheme │ └── DelaunaySwift.xcscheme ├── DelaunayTriangulation ├── Circumcircle.swift ├── DelaunaySwift.h ├── DelaunaySwift.swift ├── DelaunaySwift_MacOS-Info.plist ├── Edge.swift ├── Info.plist ├── Point.swift └── Triangle.swift ├── DelaunayTriangulationTests ├── DelaunayTriangulationSwiftTests.swift └── Info.plist ├── LICENSE ├── Package.swift ├── README.md ├── Triangulation ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── TriangleView.swift ├── Triangulation-Example-Bridging-Header.h ├── Utilities.swift └── ViewController.swift └── triangulation.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | ## Playgrounds 34 | timeline.xctimeline 35 | playground.xcworkspace 36 | 37 | # Swift Package Manager 38 | # 39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 40 | # Packages/ 41 | # Package.pins 42 | # Package.resolved 43 | # *.xcodeproj 44 | # 45 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 46 | # hence it is not needed unless you have added a package configuration file to your project 47 | # .swiftpm 48 | 49 | .build/ 50 | 51 | # CocoaPods 52 | # 53 | # We recommend against adding the Pods directory to your .gitignore. However 54 | # you should judge for yourself, the pros and cons are mentioned at: 55 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 56 | # 57 | # Pods/ 58 | # 59 | # Add this line if you want to avoid checking in source code from the Xcode workspace 60 | # *.xcworkspace 61 | 62 | # Carthage 63 | # 64 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 65 | # Carthage/Checkouts 66 | 67 | Carthage/Build/ 68 | 69 | # Accio dependency management 70 | Dependencies/ 71 | .accio/ 72 | 73 | # fastlane 74 | # 75 | # It is recommended to not store the screenshots in the git repo. 76 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 77 | # For more information about the recommended setup visit: 78 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 79 | 80 | fastlane/report.xml 81 | fastlane/Preview.html 82 | fastlane/screenshots/**/*.png 83 | fastlane/test_output 84 | 85 | # Code Injection 86 | # 87 | # After new code Injection tools there's a generated folder /iOSInjectionProject 88 | # https://github.com/johnno1962/injectionforxcode 89 | 90 | iOSInjectionProject/ -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 3.0 2 | -------------------------------------------------------------------------------- /DelaunaySwift.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |spec| 2 | spec.name = "DelaunaySwift" 3 | spec.version = "1.0.0" 4 | spec.summary = "A utility for computing the optimal set of triangles using the Delaunay Triangulations algorithm." 5 | spec.source = { :git => "https://github.com/AlexLittlejohn/DelaunaySwift.git", :tag => spec.version.to_s } 6 | spec.requires_arc = true 7 | spec.platform = :ios, "10.0" 8 | spec.license = "MIT" 9 | spec.source_files = "DelaunayTriangulation/**/*.{swift}" 10 | spec.homepage = "https://github.com/AlexLittlejohn/DelaunaySwift" 11 | spec.author = { "Alex Littlejohn" => "alexlittlejohn@me.com" } 12 | end 13 | -------------------------------------------------------------------------------- /DelaunaySwift.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C41B5BC51C3FF148006B601E /* DelaunaySwift.h in Headers */ = {isa = PBXBuildFile; fileRef = C41B5BC41C3FF148006B601E /* DelaunaySwift.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | C41B5BCC1C3FF148006B601E /* DelaunaySwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C41B5BC11C3FF148006B601E /* DelaunaySwift.framework */; }; 12 | C41B5BD11C3FF148006B601E /* DelaunayTriangulationSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41B5BD01C3FF148006B601E /* DelaunayTriangulationSwiftTests.swift */; }; 13 | C41B5BDC1C3FF667006B601E /* DelaunaySwift.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41B5BDB1C3FF667006B601E /* DelaunaySwift.swift */; }; 14 | C41B5BE01C3FF703006B601E /* Triangle.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41B5BDF1C3FF703006B601E /* Triangle.swift */; }; 15 | C41B5BE21C3FF72E006B601E /* Point.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41B5BE11C3FF72E006B601E /* Point.swift */; }; 16 | C41B5BE41C3FF751006B601E /* CircumCircle.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41B5BE31C3FF751006B601E /* CircumCircle.swift */; }; 17 | C41B5BEC1C3FFDF8006B601E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41B5BEB1C3FFDF8006B601E /* AppDelegate.swift */; }; 18 | C41B5BEE1C3FFDF8006B601E /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41B5BED1C3FFDF8006B601E /* ViewController.swift */; }; 19 | C41B5BF11C3FFDF8006B601E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C41B5BEF1C3FFDF8006B601E /* Main.storyboard */; }; 20 | C41B5BF31C3FFDF8006B601E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C41B5BF21C3FFDF8006B601E /* Assets.xcassets */; }; 21 | C41B5BF61C3FFDF8006B601E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C41B5BF41C3FFDF8006B601E /* LaunchScreen.storyboard */; }; 22 | C41B5C011C4001A2006B601E /* TriangleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41B5BFD1C3FFF1E006B601E /* TriangleView.swift */; }; 23 | C41B5C021C4001A2006B601E /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41B5BFF1C3FFF49006B601E /* Utilities.swift */; }; 24 | C45BF3591C4535C100DE404D /* DelaunaySwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C41B5BC11C3FF148006B601E /* DelaunaySwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 25 | C4C89ABD1C410B0D0022F237 /* DelaunaySwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C41B5BC11C3FF148006B601E /* DelaunaySwift.framework */; }; 26 | C4E432A91CB684DD006E3BC0 /* Edge.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4E432A81CB684DD006E3BC0 /* Edge.swift */; }; 27 | D2A9911E1F4863B600851EE9 /* Triangle.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41B5BDF1C3FF703006B601E /* Triangle.swift */; }; 28 | D2A9911F1F4863B600851EE9 /* DelaunaySwift.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41B5BDB1C3FF667006B601E /* DelaunaySwift.swift */; }; 29 | D2A991201F4863B600851EE9 /* Edge.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4E432A81CB684DD006E3BC0 /* Edge.swift */; }; 30 | D2A991211F4863B600851EE9 /* Point.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41B5BE11C3FF72E006B601E /* Point.swift */; }; 31 | D2A991221F4863B600851EE9 /* CircumCircle.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41B5BE31C3FF751006B601E /* CircumCircle.swift */; }; 32 | D2A991251F4863B600851EE9 /* DelaunaySwift.h in Headers */ = {isa = PBXBuildFile; fileRef = C41B5BC41C3FF148006B601E /* DelaunaySwift.h */; settings = {ATTRIBUTES = (Public, ); }; }; 33 | /* End PBXBuildFile section */ 34 | 35 | /* Begin PBXContainerItemProxy section */ 36 | C41B5BCD1C3FF148006B601E /* PBXContainerItemProxy */ = { 37 | isa = PBXContainerItemProxy; 38 | containerPortal = C41B5BB81C3FF148006B601E /* Project object */; 39 | proxyType = 1; 40 | remoteGlobalIDString = C41B5BC01C3FF148006B601E; 41 | remoteInfo = DelaunayTriangulationSwift; 42 | }; 43 | C45BF35A1C4535C100DE404D /* PBXContainerItemProxy */ = { 44 | isa = PBXContainerItemProxy; 45 | containerPortal = C41B5BB81C3FF148006B601E /* Project object */; 46 | proxyType = 1; 47 | remoteGlobalIDString = C41B5BC01C3FF148006B601E; 48 | remoteInfo = DelaunaySwift; 49 | }; 50 | /* End PBXContainerItemProxy section */ 51 | 52 | /* Begin PBXCopyFilesBuildPhase section */ 53 | C45BF35C1C4535C100DE404D /* Embed Frameworks */ = { 54 | isa = PBXCopyFilesBuildPhase; 55 | buildActionMask = 2147483647; 56 | dstPath = ""; 57 | dstSubfolderSpec = 10; 58 | files = ( 59 | C45BF3591C4535C100DE404D /* DelaunaySwift.framework in Embed Frameworks */, 60 | ); 61 | name = "Embed Frameworks"; 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | /* End PBXCopyFilesBuildPhase section */ 65 | 66 | /* Begin PBXFileReference section */ 67 | C41B5BC11C3FF148006B601E /* DelaunaySwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DelaunaySwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 68 | C41B5BC41C3FF148006B601E /* DelaunaySwift.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DelaunaySwift.h; sourceTree = ""; }; 69 | C41B5BC61C3FF148006B601E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 70 | C41B5BCB1C3FF148006B601E /* DelaunaySwift.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DelaunaySwift.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 71 | C41B5BD01C3FF148006B601E /* DelaunayTriangulationSwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DelaunayTriangulationSwiftTests.swift; sourceTree = ""; }; 72 | C41B5BD21C3FF148006B601E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 73 | C41B5BDB1C3FF667006B601E /* DelaunaySwift.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DelaunaySwift.swift; sourceTree = ""; }; 74 | C41B5BDF1C3FF703006B601E /* Triangle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Triangle.swift; sourceTree = ""; }; 75 | C41B5BE11C3FF72E006B601E /* Point.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Point.swift; sourceTree = ""; }; 76 | C41B5BE31C3FF751006B601E /* CircumCircle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CircumCircle.swift; sourceTree = ""; }; 77 | C41B5BE91C3FFDF8006B601E /* Triangulation.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Triangulation.app; sourceTree = BUILT_PRODUCTS_DIR; }; 78 | C41B5BEB1C3FFDF8006B601E /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 79 | C41B5BED1C3FFDF8006B601E /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 80 | C41B5BF01C3FFDF8006B601E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 81 | C41B5BF21C3FFDF8006B601E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 82 | C41B5BF51C3FFDF8006B601E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 83 | C41B5BF71C3FFDF8006B601E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 84 | C41B5BFD1C3FFF1E006B601E /* TriangleView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TriangleView.swift; sourceTree = ""; }; 85 | C41B5BFF1C3FFF49006B601E /* Utilities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Utilities.swift; sourceTree = ""; }; 86 | C4E432A81CB684DD006E3BC0 /* Edge.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Edge.swift; sourceTree = ""; }; 87 | D2A9912A1F4863B600851EE9 /* DelaunaySwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DelaunaySwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 88 | D2A991371F4865B000851EE9 /* DelaunaySwift_MacOS-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "DelaunaySwift_MacOS-Info.plist"; sourceTree = ""; }; 89 | /* End PBXFileReference section */ 90 | 91 | /* Begin PBXFrameworksBuildPhase section */ 92 | C41B5BBD1C3FF148006B601E /* Frameworks */ = { 93 | isa = PBXFrameworksBuildPhase; 94 | buildActionMask = 2147483647; 95 | files = ( 96 | ); 97 | runOnlyForDeploymentPostprocessing = 0; 98 | }; 99 | C41B5BC81C3FF148006B601E /* Frameworks */ = { 100 | isa = PBXFrameworksBuildPhase; 101 | buildActionMask = 2147483647; 102 | files = ( 103 | C41B5BCC1C3FF148006B601E /* DelaunaySwift.framework in Frameworks */, 104 | ); 105 | runOnlyForDeploymentPostprocessing = 0; 106 | }; 107 | C41B5BE61C3FFDF8006B601E /* Frameworks */ = { 108 | isa = PBXFrameworksBuildPhase; 109 | buildActionMask = 2147483647; 110 | files = ( 111 | C4C89ABD1C410B0D0022F237 /* DelaunaySwift.framework in Frameworks */, 112 | ); 113 | runOnlyForDeploymentPostprocessing = 0; 114 | }; 115 | D2A991231F4863B600851EE9 /* Frameworks */ = { 116 | isa = PBXFrameworksBuildPhase; 117 | buildActionMask = 2147483647; 118 | files = ( 119 | ); 120 | runOnlyForDeploymentPostprocessing = 0; 121 | }; 122 | /* End PBXFrameworksBuildPhase section */ 123 | 124 | /* Begin PBXGroup section */ 125 | C41B5BB71C3FF148006B601E = { 126 | isa = PBXGroup; 127 | children = ( 128 | C41B5BEA1C3FFDF8006B601E /* TriangulationExample */, 129 | C41B5BC31C3FF148006B601E /* DelaunayTriangulation */, 130 | C41B5BCF1C3FF148006B601E /* DelaunayTriangulationTests */, 131 | C41B5BC21C3FF148006B601E /* Products */, 132 | ); 133 | sourceTree = ""; 134 | }; 135 | C41B5BC21C3FF148006B601E /* Products */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | C41B5BC11C3FF148006B601E /* DelaunaySwift.framework */, 139 | C41B5BCB1C3FF148006B601E /* DelaunaySwift.xctest */, 140 | C41B5BE91C3FFDF8006B601E /* Triangulation.app */, 141 | D2A9912A1F4863B600851EE9 /* DelaunaySwift.framework */, 142 | ); 143 | name = Products; 144 | sourceTree = ""; 145 | }; 146 | C41B5BC31C3FF148006B601E /* DelaunayTriangulation */ = { 147 | isa = PBXGroup; 148 | children = ( 149 | C41B5BDB1C3FF667006B601E /* DelaunaySwift.swift */, 150 | C41B5BDF1C3FF703006B601E /* Triangle.swift */, 151 | C41B5BE11C3FF72E006B601E /* Point.swift */, 152 | C4E432A81CB684DD006E3BC0 /* Edge.swift */, 153 | C41B5BE31C3FF751006B601E /* CircumCircle.swift */, 154 | C41B5BFB1C3FFE29006B601E /* Supporting Files */, 155 | ); 156 | path = DelaunayTriangulation; 157 | sourceTree = ""; 158 | }; 159 | C41B5BCF1C3FF148006B601E /* DelaunayTriangulationTests */ = { 160 | isa = PBXGroup; 161 | children = ( 162 | C41B5BD01C3FF148006B601E /* DelaunayTriangulationSwiftTests.swift */, 163 | C41B5BD21C3FF148006B601E /* Info.plist */, 164 | ); 165 | path = DelaunayTriangulationTests; 166 | sourceTree = ""; 167 | }; 168 | C41B5BEA1C3FFDF8006B601E /* TriangulationExample */ = { 169 | isa = PBXGroup; 170 | children = ( 171 | C41B5BEB1C3FFDF8006B601E /* AppDelegate.swift */, 172 | C41B5BED1C3FFDF8006B601E /* ViewController.swift */, 173 | C41B5BFD1C3FFF1E006B601E /* TriangleView.swift */, 174 | C41B5BFF1C3FFF49006B601E /* Utilities.swift */, 175 | C41B5BFC1C3FFE3C006B601E /* Supporting Files */, 176 | ); 177 | name = TriangulationExample; 178 | path = Triangulation; 179 | sourceTree = ""; 180 | }; 181 | C41B5BFB1C3FFE29006B601E /* Supporting Files */ = { 182 | isa = PBXGroup; 183 | children = ( 184 | C41B5BC41C3FF148006B601E /* DelaunaySwift.h */, 185 | D2A991371F4865B000851EE9 /* DelaunaySwift_MacOS-Info.plist */, 186 | C41B5BC61C3FF148006B601E /* Info.plist */, 187 | ); 188 | name = "Supporting Files"; 189 | sourceTree = ""; 190 | }; 191 | C41B5BFC1C3FFE3C006B601E /* Supporting Files */ = { 192 | isa = PBXGroup; 193 | children = ( 194 | C41B5BEF1C3FFDF8006B601E /* Main.storyboard */, 195 | C41B5BF21C3FFDF8006B601E /* Assets.xcassets */, 196 | C41B5BF41C3FFDF8006B601E /* LaunchScreen.storyboard */, 197 | C41B5BF71C3FFDF8006B601E /* Info.plist */, 198 | ); 199 | name = "Supporting Files"; 200 | sourceTree = ""; 201 | }; 202 | /* End PBXGroup section */ 203 | 204 | /* Begin PBXHeadersBuildPhase section */ 205 | C41B5BBE1C3FF148006B601E /* Headers */ = { 206 | isa = PBXHeadersBuildPhase; 207 | buildActionMask = 2147483647; 208 | files = ( 209 | C41B5BC51C3FF148006B601E /* DelaunaySwift.h in Headers */, 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | }; 213 | D2A991241F4863B600851EE9 /* Headers */ = { 214 | isa = PBXHeadersBuildPhase; 215 | buildActionMask = 2147483647; 216 | files = ( 217 | D2A991251F4863B600851EE9 /* DelaunaySwift.h in Headers */, 218 | ); 219 | runOnlyForDeploymentPostprocessing = 0; 220 | }; 221 | /* End PBXHeadersBuildPhase section */ 222 | 223 | /* Begin PBXNativeTarget section */ 224 | C41B5BC01C3FF148006B601E /* DelaunaySwift */ = { 225 | isa = PBXNativeTarget; 226 | buildConfigurationList = C41B5BD51C3FF148006B601E /* Build configuration list for PBXNativeTarget "DelaunaySwift" */; 227 | buildPhases = ( 228 | C41B5BBC1C3FF148006B601E /* Sources */, 229 | C41B5BBD1C3FF148006B601E /* Frameworks */, 230 | C41B5BBE1C3FF148006B601E /* Headers */, 231 | C41B5BBF1C3FF148006B601E /* Resources */, 232 | ); 233 | buildRules = ( 234 | ); 235 | dependencies = ( 236 | ); 237 | name = DelaunaySwift; 238 | productName = DelaunayTriangulationSwift; 239 | productReference = C41B5BC11C3FF148006B601E /* DelaunaySwift.framework */; 240 | productType = "com.apple.product-type.framework"; 241 | }; 242 | C41B5BCA1C3FF148006B601E /* DelaunaySwiftTests */ = { 243 | isa = PBXNativeTarget; 244 | buildConfigurationList = C41B5BD81C3FF148006B601E /* Build configuration list for PBXNativeTarget "DelaunaySwiftTests" */; 245 | buildPhases = ( 246 | C41B5BC71C3FF148006B601E /* Sources */, 247 | C41B5BC81C3FF148006B601E /* Frameworks */, 248 | C41B5BC91C3FF148006B601E /* Resources */, 249 | ); 250 | buildRules = ( 251 | ); 252 | dependencies = ( 253 | C41B5BCE1C3FF148006B601E /* PBXTargetDependency */, 254 | ); 255 | name = DelaunaySwiftTests; 256 | productName = DelaunayTriangulationSwiftTests; 257 | productReference = C41B5BCB1C3FF148006B601E /* DelaunaySwift.xctest */; 258 | productType = "com.apple.product-type.bundle.unit-test"; 259 | }; 260 | C41B5BE81C3FFDF8006B601E /* Triangulation */ = { 261 | isa = PBXNativeTarget; 262 | buildConfigurationList = C41B5BF81C3FFDF8006B601E /* Build configuration list for PBXNativeTarget "Triangulation" */; 263 | buildPhases = ( 264 | C41B5BE51C3FFDF8006B601E /* Sources */, 265 | C41B5BE61C3FFDF8006B601E /* Frameworks */, 266 | C41B5BE71C3FFDF8006B601E /* Resources */, 267 | C45BF35C1C4535C100DE404D /* Embed Frameworks */, 268 | ); 269 | buildRules = ( 270 | ); 271 | dependencies = ( 272 | C45BF35B1C4535C100DE404D /* PBXTargetDependency */, 273 | ); 274 | name = Triangulation; 275 | productName = Triangulation; 276 | productReference = C41B5BE91C3FFDF8006B601E /* Triangulation.app */; 277 | productType = "com.apple.product-type.application"; 278 | }; 279 | D2A9911C1F4863B600851EE9 /* DelaunaySwift (MacOS) */ = { 280 | isa = PBXNativeTarget; 281 | buildConfigurationList = D2A991271F4863B600851EE9 /* Build configuration list for PBXNativeTarget "DelaunaySwift (MacOS)" */; 282 | buildPhases = ( 283 | D2A9911D1F4863B600851EE9 /* Sources */, 284 | D2A991231F4863B600851EE9 /* Frameworks */, 285 | D2A991241F4863B600851EE9 /* Headers */, 286 | D2A991261F4863B600851EE9 /* Resources */, 287 | ); 288 | buildRules = ( 289 | ); 290 | dependencies = ( 291 | ); 292 | name = "DelaunaySwift (MacOS)"; 293 | productName = DelaunayTriangulationSwift; 294 | productReference = D2A9912A1F4863B600851EE9 /* DelaunaySwift.framework */; 295 | productType = "com.apple.product-type.framework"; 296 | }; 297 | /* End PBXNativeTarget section */ 298 | 299 | /* Begin PBXProject section */ 300 | C41B5BB81C3FF148006B601E /* Project object */ = { 301 | isa = PBXProject; 302 | attributes = { 303 | LastSwiftUpdateCheck = 0720; 304 | LastUpgradeCheck = 1150; 305 | ORGANIZATIONNAME = zero; 306 | TargetAttributes = { 307 | C41B5BC01C3FF148006B601E = { 308 | CreatedOnToolsVersion = 7.2; 309 | LastSwiftMigration = 0800; 310 | }; 311 | C41B5BCA1C3FF148006B601E = { 312 | CreatedOnToolsVersion = 7.2; 313 | LastSwiftMigration = 0800; 314 | }; 315 | C41B5BE81C3FFDF8006B601E = { 316 | CreatedOnToolsVersion = 7.2; 317 | DevelopmentTeam = 2466624KEK; 318 | LastSwiftMigration = 0800; 319 | }; 320 | }; 321 | }; 322 | buildConfigurationList = C41B5BBB1C3FF148006B601E /* Build configuration list for PBXProject "DelaunaySwift" */; 323 | compatibilityVersion = "Xcode 3.2"; 324 | developmentRegion = en; 325 | hasScannedForEncodings = 0; 326 | knownRegions = ( 327 | en, 328 | Base, 329 | ); 330 | mainGroup = C41B5BB71C3FF148006B601E; 331 | productRefGroup = C41B5BC21C3FF148006B601E /* Products */; 332 | projectDirPath = ""; 333 | projectRoot = ""; 334 | targets = ( 335 | C41B5BC01C3FF148006B601E /* DelaunaySwift */, 336 | C41B5BCA1C3FF148006B601E /* DelaunaySwiftTests */, 337 | C41B5BE81C3FFDF8006B601E /* Triangulation */, 338 | D2A9911C1F4863B600851EE9 /* DelaunaySwift (MacOS) */, 339 | ); 340 | }; 341 | /* End PBXProject section */ 342 | 343 | /* Begin PBXResourcesBuildPhase section */ 344 | C41B5BBF1C3FF148006B601E /* Resources */ = { 345 | isa = PBXResourcesBuildPhase; 346 | buildActionMask = 2147483647; 347 | files = ( 348 | ); 349 | runOnlyForDeploymentPostprocessing = 0; 350 | }; 351 | C41B5BC91C3FF148006B601E /* Resources */ = { 352 | isa = PBXResourcesBuildPhase; 353 | buildActionMask = 2147483647; 354 | files = ( 355 | ); 356 | runOnlyForDeploymentPostprocessing = 0; 357 | }; 358 | C41B5BE71C3FFDF8006B601E /* Resources */ = { 359 | isa = PBXResourcesBuildPhase; 360 | buildActionMask = 2147483647; 361 | files = ( 362 | C41B5BF61C3FFDF8006B601E /* LaunchScreen.storyboard in Resources */, 363 | C41B5BF31C3FFDF8006B601E /* Assets.xcassets in Resources */, 364 | C41B5BF11C3FFDF8006B601E /* Main.storyboard in Resources */, 365 | ); 366 | runOnlyForDeploymentPostprocessing = 0; 367 | }; 368 | D2A991261F4863B600851EE9 /* Resources */ = { 369 | isa = PBXResourcesBuildPhase; 370 | buildActionMask = 2147483647; 371 | files = ( 372 | ); 373 | runOnlyForDeploymentPostprocessing = 0; 374 | }; 375 | /* End PBXResourcesBuildPhase section */ 376 | 377 | /* Begin PBXSourcesBuildPhase section */ 378 | C41B5BBC1C3FF148006B601E /* Sources */ = { 379 | isa = PBXSourcesBuildPhase; 380 | buildActionMask = 2147483647; 381 | files = ( 382 | C41B5BE01C3FF703006B601E /* Triangle.swift in Sources */, 383 | C41B5BDC1C3FF667006B601E /* DelaunaySwift.swift in Sources */, 384 | C4E432A91CB684DD006E3BC0 /* Edge.swift in Sources */, 385 | C41B5BE21C3FF72E006B601E /* Point.swift in Sources */, 386 | C41B5BE41C3FF751006B601E /* CircumCircle.swift in Sources */, 387 | ); 388 | runOnlyForDeploymentPostprocessing = 0; 389 | }; 390 | C41B5BC71C3FF148006B601E /* Sources */ = { 391 | isa = PBXSourcesBuildPhase; 392 | buildActionMask = 2147483647; 393 | files = ( 394 | C41B5BD11C3FF148006B601E /* DelaunayTriangulationSwiftTests.swift in Sources */, 395 | ); 396 | runOnlyForDeploymentPostprocessing = 0; 397 | }; 398 | C41B5BE51C3FFDF8006B601E /* Sources */ = { 399 | isa = PBXSourcesBuildPhase; 400 | buildActionMask = 2147483647; 401 | files = ( 402 | C41B5BEE1C3FFDF8006B601E /* ViewController.swift in Sources */, 403 | C41B5C011C4001A2006B601E /* TriangleView.swift in Sources */, 404 | C41B5C021C4001A2006B601E /* Utilities.swift in Sources */, 405 | C41B5BEC1C3FFDF8006B601E /* AppDelegate.swift in Sources */, 406 | ); 407 | runOnlyForDeploymentPostprocessing = 0; 408 | }; 409 | D2A9911D1F4863B600851EE9 /* Sources */ = { 410 | isa = PBXSourcesBuildPhase; 411 | buildActionMask = 2147483647; 412 | files = ( 413 | D2A9911E1F4863B600851EE9 /* Triangle.swift in Sources */, 414 | D2A9911F1F4863B600851EE9 /* DelaunaySwift.swift in Sources */, 415 | D2A991201F4863B600851EE9 /* Edge.swift in Sources */, 416 | D2A991211F4863B600851EE9 /* Point.swift in Sources */, 417 | D2A991221F4863B600851EE9 /* CircumCircle.swift in Sources */, 418 | ); 419 | runOnlyForDeploymentPostprocessing = 0; 420 | }; 421 | /* End PBXSourcesBuildPhase section */ 422 | 423 | /* Begin PBXTargetDependency section */ 424 | C41B5BCE1C3FF148006B601E /* PBXTargetDependency */ = { 425 | isa = PBXTargetDependency; 426 | target = C41B5BC01C3FF148006B601E /* DelaunaySwift */; 427 | targetProxy = C41B5BCD1C3FF148006B601E /* PBXContainerItemProxy */; 428 | }; 429 | C45BF35B1C4535C100DE404D /* PBXTargetDependency */ = { 430 | isa = PBXTargetDependency; 431 | target = C41B5BC01C3FF148006B601E /* DelaunaySwift */; 432 | targetProxy = C45BF35A1C4535C100DE404D /* PBXContainerItemProxy */; 433 | }; 434 | /* End PBXTargetDependency section */ 435 | 436 | /* Begin PBXVariantGroup section */ 437 | C41B5BEF1C3FFDF8006B601E /* Main.storyboard */ = { 438 | isa = PBXVariantGroup; 439 | children = ( 440 | C41B5BF01C3FFDF8006B601E /* Base */, 441 | ); 442 | name = Main.storyboard; 443 | sourceTree = ""; 444 | }; 445 | C41B5BF41C3FFDF8006B601E /* LaunchScreen.storyboard */ = { 446 | isa = PBXVariantGroup; 447 | children = ( 448 | C41B5BF51C3FFDF8006B601E /* Base */, 449 | ); 450 | name = LaunchScreen.storyboard; 451 | sourceTree = ""; 452 | }; 453 | /* End PBXVariantGroup section */ 454 | 455 | /* Begin XCBuildConfiguration section */ 456 | C41B5BD31C3FF148006B601E /* Debug */ = { 457 | isa = XCBuildConfiguration; 458 | buildSettings = { 459 | ALWAYS_SEARCH_USER_PATHS = NO; 460 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 461 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 462 | CLANG_CXX_LIBRARY = "libc++"; 463 | CLANG_ENABLE_MODULES = YES; 464 | CLANG_ENABLE_OBJC_ARC = YES; 465 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 466 | CLANG_WARN_BOOL_CONVERSION = YES; 467 | CLANG_WARN_COMMA = YES; 468 | CLANG_WARN_CONSTANT_CONVERSION = YES; 469 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 470 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 471 | CLANG_WARN_EMPTY_BODY = YES; 472 | CLANG_WARN_ENUM_CONVERSION = YES; 473 | CLANG_WARN_INFINITE_RECURSION = YES; 474 | CLANG_WARN_INT_CONVERSION = YES; 475 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 476 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 477 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 478 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 479 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 480 | CLANG_WARN_STRICT_PROTOTYPES = YES; 481 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 482 | CLANG_WARN_UNREACHABLE_CODE = YES; 483 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 484 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 485 | COPY_PHASE_STRIP = NO; 486 | CURRENT_PROJECT_VERSION = 1; 487 | DEBUG_INFORMATION_FORMAT = dwarf; 488 | ENABLE_STRICT_OBJC_MSGSEND = YES; 489 | ENABLE_TESTABILITY = YES; 490 | GCC_C_LANGUAGE_STANDARD = gnu99; 491 | GCC_DYNAMIC_NO_PIC = NO; 492 | GCC_NO_COMMON_BLOCKS = YES; 493 | GCC_OPTIMIZATION_LEVEL = 0; 494 | GCC_PREPROCESSOR_DEFINITIONS = ( 495 | "DEBUG=1", 496 | "$(inherited)", 497 | ); 498 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 499 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 500 | GCC_WARN_UNDECLARED_SELECTOR = YES; 501 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 502 | GCC_WARN_UNUSED_FUNCTION = YES; 503 | GCC_WARN_UNUSED_VARIABLE = YES; 504 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 505 | MTL_ENABLE_DEBUG_INFO = YES; 506 | ONLY_ACTIVE_ARCH = YES; 507 | SDKROOT = iphoneos; 508 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 509 | SWIFT_VERSION = 5.0; 510 | TARGETED_DEVICE_FAMILY = "1,2"; 511 | VERSIONING_SYSTEM = "apple-generic"; 512 | VERSION_INFO_PREFIX = ""; 513 | }; 514 | name = Debug; 515 | }; 516 | C41B5BD41C3FF148006B601E /* Release */ = { 517 | isa = XCBuildConfiguration; 518 | buildSettings = { 519 | ALWAYS_SEARCH_USER_PATHS = NO; 520 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 521 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 522 | CLANG_CXX_LIBRARY = "libc++"; 523 | CLANG_ENABLE_MODULES = YES; 524 | CLANG_ENABLE_OBJC_ARC = YES; 525 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 526 | CLANG_WARN_BOOL_CONVERSION = YES; 527 | CLANG_WARN_COMMA = YES; 528 | CLANG_WARN_CONSTANT_CONVERSION = YES; 529 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 530 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 531 | CLANG_WARN_EMPTY_BODY = YES; 532 | CLANG_WARN_ENUM_CONVERSION = YES; 533 | CLANG_WARN_INFINITE_RECURSION = YES; 534 | CLANG_WARN_INT_CONVERSION = YES; 535 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 536 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 537 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 538 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 539 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 540 | CLANG_WARN_STRICT_PROTOTYPES = YES; 541 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 542 | CLANG_WARN_UNREACHABLE_CODE = YES; 543 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 544 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 545 | COPY_PHASE_STRIP = NO; 546 | CURRENT_PROJECT_VERSION = 1; 547 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 548 | ENABLE_NS_ASSERTIONS = NO; 549 | ENABLE_STRICT_OBJC_MSGSEND = YES; 550 | GCC_C_LANGUAGE_STANDARD = gnu99; 551 | GCC_NO_COMMON_BLOCKS = YES; 552 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 553 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 554 | GCC_WARN_UNDECLARED_SELECTOR = YES; 555 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 556 | GCC_WARN_UNUSED_FUNCTION = YES; 557 | GCC_WARN_UNUSED_VARIABLE = YES; 558 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 559 | MTL_ENABLE_DEBUG_INFO = NO; 560 | SDKROOT = iphoneos; 561 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 562 | SWIFT_VERSION = 5.0; 563 | TARGETED_DEVICE_FAMILY = "1,2"; 564 | VALIDATE_PRODUCT = YES; 565 | VERSIONING_SYSTEM = "apple-generic"; 566 | VERSION_INFO_PREFIX = ""; 567 | }; 568 | name = Release; 569 | }; 570 | C41B5BD61C3FF148006B601E /* Debug */ = { 571 | isa = XCBuildConfiguration; 572 | buildSettings = { 573 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 574 | CLANG_ENABLE_MODULES = YES; 575 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 576 | DEFINES_MODULE = YES; 577 | DYLIB_COMPATIBILITY_VERSION = 1; 578 | DYLIB_CURRENT_VERSION = 1; 579 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 580 | INFOPLIST_FILE = DelaunayTriangulation/Info.plist; 581 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 582 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 583 | PRODUCT_BUNDLE_IDENTIFIER = com.zero.DelaunaySwift; 584 | PRODUCT_NAME = DelaunaySwift; 585 | SKIP_INSTALL = YES; 586 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 587 | }; 588 | name = Debug; 589 | }; 590 | C41B5BD71C3FF148006B601E /* Release */ = { 591 | isa = XCBuildConfiguration; 592 | buildSettings = { 593 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 594 | CLANG_ENABLE_MODULES = YES; 595 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 596 | DEFINES_MODULE = YES; 597 | DYLIB_COMPATIBILITY_VERSION = 1; 598 | DYLIB_CURRENT_VERSION = 1; 599 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 600 | INFOPLIST_FILE = DelaunayTriangulation/Info.plist; 601 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 602 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 603 | PRODUCT_BUNDLE_IDENTIFIER = com.zero.DelaunaySwift; 604 | PRODUCT_NAME = DelaunaySwift; 605 | SKIP_INSTALL = YES; 606 | }; 607 | name = Release; 608 | }; 609 | C41B5BD91C3FF148006B601E /* Debug */ = { 610 | isa = XCBuildConfiguration; 611 | buildSettings = { 612 | INFOPLIST_FILE = DelaunayTriangulationTests/Info.plist; 613 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 614 | PRODUCT_BUNDLE_IDENTIFIER = com.zero.DelaunayTriangulationTests; 615 | PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)Tests"; 616 | PRODUCT_NAME = DelaunaySwift; 617 | }; 618 | name = Debug; 619 | }; 620 | C41B5BDA1C3FF148006B601E /* Release */ = { 621 | isa = XCBuildConfiguration; 622 | buildSettings = { 623 | INFOPLIST_FILE = DelaunayTriangulationTests/Info.plist; 624 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 625 | PRODUCT_BUNDLE_IDENTIFIER = com.zero.DelaunayTriangulationTests; 626 | PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)Tests"; 627 | PRODUCT_NAME = DelaunaySwift; 628 | }; 629 | name = Release; 630 | }; 631 | C41B5BF91C3FFDF8006B601E /* Debug */ = { 632 | isa = XCBuildConfiguration; 633 | buildSettings = { 634 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 635 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 636 | DEVELOPMENT_TEAM = 2466624KEK; 637 | INFOPLIST_FILE = Triangulation/Info.plist; 638 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 639 | PRODUCT_BUNDLE_IDENTIFIER = com.zero.Triangulation; 640 | PRODUCT_NAME = "$(TARGET_NAME)"; 641 | }; 642 | name = Debug; 643 | }; 644 | C41B5BFA1C3FFDF8006B601E /* Release */ = { 645 | isa = XCBuildConfiguration; 646 | buildSettings = { 647 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 648 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 649 | DEVELOPMENT_TEAM = 2466624KEK; 650 | INFOPLIST_FILE = Triangulation/Info.plist; 651 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 652 | PRODUCT_BUNDLE_IDENTIFIER = com.zero.Triangulation; 653 | PRODUCT_NAME = "$(TARGET_NAME)"; 654 | }; 655 | name = Release; 656 | }; 657 | D2A991281F4863B600851EE9 /* Debug */ = { 658 | isa = XCBuildConfiguration; 659 | buildSettings = { 660 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 661 | CLANG_ENABLE_MODULES = YES; 662 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 663 | DEFINES_MODULE = YES; 664 | DYLIB_COMPATIBILITY_VERSION = 1; 665 | DYLIB_CURRENT_VERSION = 1; 666 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 667 | INFOPLIST_FILE = "DelaunayTriangulation/DelaunaySwift_MacOS-Info.plist"; 668 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 669 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 670 | MACOSX_DEPLOYMENT_TARGET = 10.11; 671 | PRODUCT_BUNDLE_IDENTIFIER = com.zero.DelaunaySwift; 672 | PRODUCT_NAME = DelaunaySwift; 673 | SDKROOT = macosx; 674 | SKIP_INSTALL = YES; 675 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 676 | VALID_ARCHS = x86_64; 677 | }; 678 | name = Debug; 679 | }; 680 | D2A991291F4863B600851EE9 /* Release */ = { 681 | isa = XCBuildConfiguration; 682 | buildSettings = { 683 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 684 | CLANG_ENABLE_MODULES = YES; 685 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 686 | DEFINES_MODULE = YES; 687 | DYLIB_COMPATIBILITY_VERSION = 1; 688 | DYLIB_CURRENT_VERSION = 1; 689 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 690 | INFOPLIST_FILE = "DelaunayTriangulation/DelaunaySwift_MacOS-Info.plist"; 691 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 692 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 693 | MACOSX_DEPLOYMENT_TARGET = 10.11; 694 | PRODUCT_BUNDLE_IDENTIFIER = com.zero.DelaunaySwift; 695 | PRODUCT_NAME = DelaunaySwift; 696 | SDKROOT = macosx; 697 | SKIP_INSTALL = YES; 698 | VALID_ARCHS = x86_64; 699 | }; 700 | name = Release; 701 | }; 702 | /* End XCBuildConfiguration section */ 703 | 704 | /* Begin XCConfigurationList section */ 705 | C41B5BBB1C3FF148006B601E /* Build configuration list for PBXProject "DelaunaySwift" */ = { 706 | isa = XCConfigurationList; 707 | buildConfigurations = ( 708 | C41B5BD31C3FF148006B601E /* Debug */, 709 | C41B5BD41C3FF148006B601E /* Release */, 710 | ); 711 | defaultConfigurationIsVisible = 0; 712 | defaultConfigurationName = Release; 713 | }; 714 | C41B5BD51C3FF148006B601E /* Build configuration list for PBXNativeTarget "DelaunaySwift" */ = { 715 | isa = XCConfigurationList; 716 | buildConfigurations = ( 717 | C41B5BD61C3FF148006B601E /* Debug */, 718 | C41B5BD71C3FF148006B601E /* Release */, 719 | ); 720 | defaultConfigurationIsVisible = 0; 721 | defaultConfigurationName = Release; 722 | }; 723 | C41B5BD81C3FF148006B601E /* Build configuration list for PBXNativeTarget "DelaunaySwiftTests" */ = { 724 | isa = XCConfigurationList; 725 | buildConfigurations = ( 726 | C41B5BD91C3FF148006B601E /* Debug */, 727 | C41B5BDA1C3FF148006B601E /* Release */, 728 | ); 729 | defaultConfigurationIsVisible = 0; 730 | defaultConfigurationName = Release; 731 | }; 732 | C41B5BF81C3FFDF8006B601E /* Build configuration list for PBXNativeTarget "Triangulation" */ = { 733 | isa = XCConfigurationList; 734 | buildConfigurations = ( 735 | C41B5BF91C3FFDF8006B601E /* Debug */, 736 | C41B5BFA1C3FFDF8006B601E /* Release */, 737 | ); 738 | defaultConfigurationIsVisible = 0; 739 | defaultConfigurationName = Release; 740 | }; 741 | D2A991271F4863B600851EE9 /* Build configuration list for PBXNativeTarget "DelaunaySwift (MacOS)" */ = { 742 | isa = XCConfigurationList; 743 | buildConfigurations = ( 744 | D2A991281F4863B600851EE9 /* Debug */, 745 | D2A991291F4863B600851EE9 /* Release */, 746 | ); 747 | defaultConfigurationIsVisible = 0; 748 | defaultConfigurationName = Release; 749 | }; 750 | /* End XCConfigurationList section */ 751 | }; 752 | rootObject = C41B5BB81C3FF148006B601E /* Project object */; 753 | } 754 | -------------------------------------------------------------------------------- /DelaunaySwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DelaunaySwift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /DelaunaySwift.xcodeproj/xcshareddata/xcschemes/DelaunaySwift (MacOS).xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /DelaunaySwift.xcodeproj/xcshareddata/xcschemes/DelaunaySwift.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 65 | 71 | 72 | 73 | 74 | 75 | 76 | 82 | 83 | 89 | 90 | 91 | 92 | 94 | 95 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /DelaunayTriangulation/Circumcircle.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Circumcircle.swift 3 | // DelaunayTriangulationSwift 4 | // 5 | // Created by Alex Littlejohn on 2016/01/08. 6 | // Copyright © 2016 zero. All rights reserved. 7 | // 8 | 9 | /// Represents a circle which intersects a set of 3 points 10 | internal struct Circumcircle: Hashable { 11 | let point1: Point 12 | let point2: Point 13 | let point3: Point 14 | let x: Double 15 | let y: Double 16 | let rsqr: Double 17 | } 18 | -------------------------------------------------------------------------------- /DelaunayTriangulation/DelaunaySwift.h: -------------------------------------------------------------------------------- 1 | // 2 | // DelaunayTriangulationSwift.h 3 | // DelaunayTriangulationSwift 4 | // 5 | // Created by Alex Littlejohn on 2016/01/08. 6 | // Copyright © 2016 zero. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for DelaunayTriangulationSwift. 12 | FOUNDATION_EXPORT double DelaunayTriangulationSwiftVersionNumber; 13 | 14 | //! Project version string for DelaunayTriangulationSwift. 15 | FOUNDATION_EXPORT const unsigned char DelaunayTriangulationSwiftVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import -------------------------------------------------------------------------------- /DelaunayTriangulation/DelaunaySwift.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Delaunay.swift 3 | // DelaunayTriangulationSwift 4 | // 5 | // Created by Alex Littlejohn on 2016/01/08. 6 | // Copyright © 2016 zero. All rights reserved. 7 | // 8 | 9 | /// Generates a supertraingle containing all other triangles 10 | internal func supertriangle(_ points: [Point]) -> [Point] { 11 | var xmin = Double(Int32.max) 12 | var ymin = Double(Int32.max) 13 | var xmax = -Double(Int32.max) 14 | var ymax = -Double(Int32.max) 15 | 16 | for i in 0.. xmax { xmax = points[i].x } 19 | if points[i].y < ymin { ymin = points[i].y } 20 | if points[i].y > ymax { ymax = points[i].y } 21 | } 22 | 23 | let dx = xmax - xmin 24 | let dy = ymax - ymin 25 | let dmax = max(dx, dy) 26 | let xmid = xmin + dx * 0.5 27 | let ymid = ymin + dy * 0.5 28 | 29 | return [ 30 | Point(x: xmid - 20 * dmax, y: ymid - dmax), 31 | Point(x: xmid, y: ymid + 20 * dmax), 32 | Point(x: xmid + 20 * dmax, y: ymid - dmax) 33 | ] 34 | } 35 | 36 | /// Calculate the intersecting circumcircle for a set of 3 points 37 | internal func circumcircle(_ i: Point, j: Point, k: Point) -> Circumcircle { 38 | let x1 = i.x 39 | let y1 = i.y 40 | let x2 = j.x 41 | let y2 = j.y 42 | let x3 = k.x 43 | let y3 = k.y 44 | let xc: Double 45 | let yc: Double 46 | 47 | let fabsy1y2 = abs(y1 - y2) 48 | let fabsy2y3 = abs(y2 - y3) 49 | 50 | if fabsy1y2 < Double.ulpOfOne { 51 | let m2 = -((x3 - x2) / (y3 - y2)) 52 | let mx2 = (x2 + x3) / 2 53 | let my2 = (y2 + y3) / 2 54 | xc = (x2 + x1) / 2 55 | yc = m2 * (xc - mx2) + my2 56 | } else if fabsy2y3 < Double.ulpOfOne { 57 | let m1 = -((x2 - x1) / (y2 - y1)) 58 | let mx1 = (x1 + x2) / 2 59 | let my1 = (y1 + y2) / 2 60 | xc = (x3 + x2) / 2 61 | yc = m1 * (xc - mx1) + my1 62 | } else { 63 | let m1 = -((x2 - x1) / (y2 - y1)) 64 | let m2 = -((x3 - x2) / (y3 - y2)) 65 | let mx1 = (x1 + x2) / 2 66 | let mx2 = (x2 + x3) / 2 67 | let my1 = (y1 + y2) / 2 68 | let my2 = (y2 + y3) / 2 69 | xc = (m1 * mx1 - m2 * mx2 + my2 - my1) / (m1 - m2) 70 | 71 | if fabsy1y2 > fabsy2y3 { 72 | yc = m1 * (xc - mx1) + my1 73 | } else { 74 | yc = m2 * (xc - mx2) + my2 75 | } 76 | } 77 | 78 | let dx = x2 - xc 79 | let dy = y2 - yc 80 | let rsqr = dx * dx + dy * dy 81 | 82 | return Circumcircle(point1: i, point2: j, point3: k, x: xc, y: yc, rsqr: rsqr) 83 | } 84 | 85 | /// Deduplicate a collection of edges 86 | internal func dedup(_ edges: [Point]) -> [Point] { 87 | 88 | var e = edges 89 | var a: Point?, b: Point?, m: Point?, n: Point? 90 | 91 | var j = e.count 92 | while j > 0 { 93 | j -= 1 94 | b = j < e.count ? e[j] : nil 95 | j -= 1 96 | a = j < e.count ? e[j] : nil 97 | 98 | var i = j 99 | while i > 0 { 100 | i -= 1 101 | n = e[i] 102 | i -= 1 103 | m = e[i] 104 | 105 | if (a == m && b == n) || (a == n && b == m) { 106 | e.removeSubrange(j...j + 1) 107 | e.removeSubrange(i...i + 1) 108 | break 109 | } 110 | } 111 | } 112 | 113 | return e 114 | } 115 | 116 | public func triangulate(_ points: [Point]) -> [Triangle] { 117 | 118 | var _points = Array(Set.init(points)) 119 | 120 | guard _points.count >= 3 else { 121 | return [Triangle]() 122 | } 123 | 124 | let n = _points.count 125 | var open = [Circumcircle]() 126 | var completed = [Circumcircle]() 127 | var edges = [Point]() 128 | 129 | /* Make an array of indices into the point array, sorted by the 130 | * points' x-position. */ 131 | let indices = [Int](0.. 0 && dx * dx > open[j].rsqr { 160 | completed.append(open.remove(at: j)) 161 | continue 162 | } 163 | 164 | /* If we're outside the circumcircle, skip this triangle. */ 165 | let dy = _points[c].y - open[j].y 166 | 167 | if dx * dx + dy * dy - open[j].rsqr > Double.ulpOfOne { 168 | continue 169 | } 170 | 171 | /* Remove the triangle and add it's edges to the edge list. */ 172 | edges += [ 173 | open[j].point1, open[j].point2, 174 | open[j].point2, open[j].point3, 175 | open[j].point3, open[j].point1 176 | ] 177 | 178 | open.remove(at: j) 179 | } 180 | 181 | /* Remove any doubled edges. */ 182 | edges = dedup(edges) 183 | 184 | /* Add a new triangle for each edge. */ 185 | var j = edges.count 186 | while j > 0 { 187 | 188 | j -= 1 189 | let b = edges[j] 190 | j -= 1 191 | let a = edges[j] 192 | open.append(circumcircle(a, j: b, k: _points[c])) 193 | } 194 | } 195 | 196 | /* Copy any remaining open triangles to the closed list, and then 197 | * remove any triangles that share a point with the supertriangle, 198 | * building a list of triplets that represent triangles. */ 199 | completed += open 200 | 201 | let ignored: Set = [_points[n], _points[n + 1], _points[n + 2]] 202 | 203 | let results = completed.compactMap { (circumCircle) -> Triangle? in 204 | 205 | let current: Set = [circumCircle.point1, circumCircle.point2, circumCircle.point3] 206 | let intersection = ignored.intersection(current) 207 | if intersection.count > 0 { 208 | return nil 209 | } 210 | 211 | return Triangle(point1: circumCircle.point1, point2: circumCircle.point2, point3: circumCircle.point3) 212 | } 213 | 214 | /* Yay, we're done! */ 215 | return results 216 | } 217 | 218 | -------------------------------------------------------------------------------- /DelaunayTriangulation/DelaunaySwift_MacOS-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /DelaunayTriangulation/Edge.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Edge.swift 3 | // DelaunaySwift 4 | // 5 | // Created by Alex Littlejohn on 2016/04/07. 6 | // Copyright © 2016 zero. All rights reserved. 7 | // 8 | 9 | //internal struct Edge: Hashable { 10 | // let point1: Point 11 | // let point2: Point 12 | //} 13 | -------------------------------------------------------------------------------- /DelaunayTriangulation/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /DelaunayTriangulation/Point.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Point.swift 3 | // DelaunayTriangulationSwift 4 | // 5 | // Created by Alex Littlejohn on 2016/01/08. 6 | // Copyright © 2016 zero. All rights reserved. 7 | // 8 | 9 | public struct Point: Hashable { 10 | 11 | public let x: Double 12 | public let y: Double 13 | 14 | public init(x: Double, y: Double) { 15 | self.x = x 16 | self.y = y 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DelaunayTriangulation/Triangle.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Triangle.swift 3 | // DelaunayTriangulationSwift 4 | // 5 | // Created by Alex Littlejohn on 2016/01/08. 6 | // Copyright © 2016 zero. All rights reserved. 7 | // 8 | 9 | /// A simple struct representing 3 points 10 | public struct Triangle: Hashable { 11 | 12 | public init(point1: Point, point2: Point, point3: Point) { 13 | self.point1 = point1 14 | self.point2 = point2 15 | self.point3 = point3 16 | } 17 | 18 | public let point1: Point 19 | public let point2: Point 20 | public let point3: Point 21 | } 22 | -------------------------------------------------------------------------------- /DelaunayTriangulationTests/DelaunayTriangulationSwiftTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DelaunayTriangulationSwiftTests.swift 3 | // DelaunayTriangulationSwiftTests 4 | // 5 | // Created by Alex Littlejohn on 2016/01/08. 6 | // Copyright © 2016 Alex Littlejohn. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import DelaunaySwift 11 | 12 | class DelaunayTriangulationSwiftTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /DelaunayTriangulationTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Alex Littlejohn 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.1 2 | import PackageDescription 3 | 4 | let package = Package( 5 | name: "DelaunayTriangulation", 6 | platforms: [ 7 | .macOS(.v10_11), 8 | .iOS(.v10), 9 | .tvOS(.v12), 10 | .watchOS(.v6) 11 | ], 12 | products: [ 13 | .library( 14 | name: "DelaunayTriangulation", 15 | targets: ["DelaunayTriangulation"]), 16 | ], 17 | targets: [ 18 | .target( 19 | name: "DelaunayTriangulation", 20 | dependencies: [], 21 | path: "DelaunayTriangulation"), 22 | ] 23 | ) 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DelaunayTriangulationSwift 2 | Delaunay Triangulation implementation written in swift [https://en.wikipedia.org/wiki/Delaunay_triangulation](https://en.wikipedia.org/wiki/Delaunay_triangulation) 3 | 4 | --- 5 | 6 | ### Usage 7 | 8 | Generate a set of vertices and pass them into `Delaunay.triangulate(vertices)` which will then return the optimal set of triangles. 9 | 10 | See the example project for more details. 11 | 12 | ![Triangulation Example](https://raw.githubusercontent.com/AlexLittlejohn/DelaunaySwift/master/triangulation.png) 13 | -------------------------------------------------------------------------------- /Triangulation/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Triangulation 4 | // 5 | // Created by Alex Littlejohn on 2016/01/08. 6 | // Copyright © 2016 zero. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /Triangulation/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /Triangulation/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Triangulation/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Triangulation/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Triangulation/TriangleView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TriangleView.swift 3 | // DelaunayTriangulationSwift 4 | // 5 | // Created by Alex Littlejohn on 2016/01/08. 6 | // Copyright © 2016 zero. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import GameplayKit 11 | import DelaunaySwift 12 | 13 | /// Generate set of points for our triangulation to use 14 | func generateVertices(_ size: CGSize, cellSize: CGFloat, variance: CGFloat = 0.75, seed: UInt64 = UInt64.random(in: 0.. [Point] { 15 | 16 | // How many cells we're going to have on each axis (pad by 2 cells on each edge) 17 | let cellsX = (size.width + 4 * cellSize) / cellSize 18 | let cellsY = (size.height + 4 * cellSize) / cellSize 19 | 20 | // figure out the bleed widths to center the grid 21 | let bleedX = ((cellsX * cellSize) - size.width)/2 22 | let bleedY = ((cellsY * cellSize) - size.height)/2 23 | 24 | let _variance = cellSize * variance / 4 25 | 26 | var points = [Point]() 27 | let minX = -bleedX 28 | let maxX = size.width + bleedX 29 | let minY = -bleedY 30 | let maxY = size.height + bleedY 31 | 32 | let generator = GKLinearCongruentialRandomSource(seed: seed) 33 | 34 | for i in stride(from: minX, to: maxX, by: cellSize) { 35 | for j in stride(from: minY, to: maxY, by: cellSize) { 36 | 37 | let x = i + cellSize/2 + CGFloat(generator.nextUniform()) + CGFloat.random(in: -_variance..._variance) 38 | let y = j + cellSize/2 + CGFloat(generator.nextUniform()) + CGFloat.random(in: -_variance..._variance) 39 | 40 | points.append(Point(x: Double(x), y: Double(y))) 41 | } 42 | } 43 | 44 | return points 45 | } 46 | 47 | class TriangleView: UIView { 48 | var triangles: [(Triangle, CAShapeLayer)] = [] 49 | 50 | override init(frame: CGRect) { 51 | super.init(frame: frame) 52 | } 53 | 54 | required init?(coder aDecoder: NSCoder) { 55 | super.init(coder: aDecoder) 56 | } 57 | 58 | override func didMoveToSuperview() { 59 | initTriangles() 60 | } 61 | 62 | func initTriangles() { 63 | for (_, triangleLayer) in triangles { 64 | triangleLayer.removeFromSuperlayer() 65 | } 66 | 67 | let points = generateVertices(bounds.size, cellSize: 80) 68 | let delaunayTriangles = triangulate(points) 69 | 70 | triangles = [] 71 | for triangle in delaunayTriangles { 72 | let triangleLayer = CAShapeLayer() 73 | triangleLayer.path = triangle.toPath() 74 | triangleLayer.fillColor = UIColor().randomColor().cgColor 75 | triangleLayer.backgroundColor = UIColor.clear.cgColor 76 | layer.addSublayer(triangleLayer) 77 | 78 | triangles.append((triangle, triangleLayer)) 79 | } 80 | } 81 | 82 | @IBAction func singleTap(recognizer: UITapGestureRecognizer) { 83 | if recognizer.state == .ended { 84 | let tapLocation = recognizer.location(in: self) 85 | let vertex = Point(point: tapLocation) 86 | for (triangle, triangleLayer) in triangles { 87 | if vertex.inside(triangle) { 88 | triangleLayer.fillColor = UIColor.black.cgColor 89 | } 90 | } 91 | } 92 | } 93 | 94 | @IBAction func doubleTap(recognizer: UITapGestureRecognizer) { 95 | if recognizer.state == .ended { 96 | initTriangles() 97 | } 98 | } 99 | } 100 | 101 | -------------------------------------------------------------------------------- /Triangulation/Triangulation-Example-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import 2 | -------------------------------------------------------------------------------- /Triangulation/Utilities.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Utilities.swift 3 | // DelaunayTriangulationSwift 4 | // 5 | // Created by Alex Littlejohn on 2016/01/08. 6 | // Copyright © 2016 zero. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import DelaunaySwift 11 | 12 | extension Triangle { 13 | func toPath() -> CGPath { 14 | 15 | let path = CGMutablePath() 16 | let p1 = point1.pointValue() 17 | let p2 = point2.pointValue() 18 | let p3 = point3.pointValue() 19 | 20 | path.move(to: p1) 21 | path.addLine(to: p2) 22 | path.addLine(to: p3) 23 | path.addLine(to: p1) 24 | 25 | path.closeSubpath() 26 | 27 | return path 28 | } 29 | } 30 | 31 | extension Point { 32 | public init(point: CGPoint) { 33 | self.init(x: Double(point.x), y: Double(point.y)) 34 | } 35 | 36 | public func pointValue() -> CGPoint { 37 | return CGPoint(x: x, y: y) 38 | } 39 | 40 | public func inside(_ triangle: Triangle) -> Bool { 41 | func sign(p: Point, v0: Point, v1: Point) -> Double { 42 | return (p.x - v1.x) * (v0.y - v1.y) - (v0.x - v1.x) * (p.y - v1.y) 43 | } 44 | 45 | let s1 = sign(p: self, v0: triangle.point1, v1: triangle.point2) 46 | let s2 = sign(p: self, v0: triangle.point2, v1: triangle.point3) 47 | let s3 = sign(p: self, v0: triangle.point3, v1: triangle.point1) 48 | return (s1 * s2 >= 0) && (s2 * s3 >= 0) 49 | } 50 | } 51 | 52 | extension UIColor { 53 | func randomColor() -> UIColor { 54 | let hue = CGFloat.random(in: 0...1) // 0.0 to 1.0 55 | let saturation: CGFloat = 0.5 // 0.5 to 1.0, away from white 56 | let brightness: CGFloat = 1.0 // 0.5 to 1.0, away from black 57 | let color = UIColor(hue: hue, saturation: saturation, brightness: brightness, alpha: 1) 58 | return color 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Triangulation/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Triangulation 4 | // 5 | // Created by Alex Littlejohn on 2016/01/08. 6 | // Copyright © 2016 zero. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | } 13 | -------------------------------------------------------------------------------- /triangulation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexLittlejohn/DelaunaySwift/5738c6a3b140d990a5dd89fe50d0cae933268bda/triangulation.png --------------------------------------------------------------------------------