wilhelmoks / voronoilibswift Goto Github PK
View Code? Open in Web Editor NEWSwift implementation of Fortunes Algorithm.
License: MIT License
Swift implementation of Fortunes Algorithm.
License: MIT License
Hello, I think I found a problem with the polygon generation algorithm. When using a specific set of coordinates I get a polygon with only 2 sides (in my code).
I adapted the iOS example with my own values to get a visualization for the problem at it is quite strange. Without filling in the polygons everything looks alright, but when turning on polygon fill you can clearly see that something is not right.
I modified the iOS example like this:
private func makeSites(forViewSize size: CGSize) {
let numberOfSites = 30
Random.setGlobalSeed(pointsSeed)
var coords: [Double] = [467.14, 115.11, 467.14, 160.03, 467.14, 204.94, 467.14, 249.86, 467.14, 294.78, 467.14, 339.7, 496.64, 115.11, 496.64, 160.03, 496.64, 204.94, 496.64, 249.86, 496.64, 294.78, 496.64, 339.7, 526.14, 115.11, 526.14, 160.03, 526.14, 204.94, 526.14, 249.86, 526.14, 294.78, 526.14, 339.7, 674.12, 160.03, 555.64, 204.94, 555.64, 249.86, 555.64, 294.78, 555.64, 339.7, 585.14, 115.11, 585.14, 160.03, 585.14, 204.94, 585.14, 249.86, 585.14, 294.78, 585.14, 339.7, 614.64, 115.11, 614.64, 160.03, 614.64, 204.94, 614.64, 249.86, 614.64, 294.78, 614.64, 339.7, 644.14, 160.03, 644.14, 204.94, 644.14, 249.86, 644.14, 294.78, 644.14, 339.7, 673.64, 204.94, 673.64, 249.86, 673.64, 294.78, 673.64, 339.7, 703.14, 294.78, 703.14, 339.7]
sitePoints = []
var i: Int = 0
while(i < coords.count) {
let point = SIMD2<Double>(x: coords[i], y: coords[i+1])
let color = randomColor()
sitePoints.append(SitePoint(point: point, userData: color))
i = i + 2
}
/*for _ in 0..<numberOfSites {
let point = randomPointInArea(withSize: size)
let color = randomColor()
sitePoints.append(SitePoint(point: point, userData: color))
}*/
}
Hi, this is working well but creates zombies.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.